good morning!!!!

Skip to content
Snippets Groups Projects
Commit 42123b43 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

Fixed peer handling

parent 0ae6a388
No related branches found
No related tags found
No related merge requests found
...@@ -319,7 +319,8 @@ func (p *Peer) HandleInbound() { ...@@ -319,7 +319,8 @@ func (p *Peer) HandleInbound() {
peers := make([]string, data.Length()) peers := make([]string, data.Length())
// Parse each possible peer // Parse each possible peer
for i := 0; i < data.Length(); i++ { for i := 0; i < data.Length(); i++ {
peers[i] = unpackAddr(data.Get(i).Get(0), data.Get(i).Get(1).AsUint()) value := ethutil.NewValue(data.Get(i).AsRaw())
peers[i] = unpackAddr(value.Get(0), value.Get(1).Uint())
} }
// Connect to the list of peers // Connect to the list of peers
...@@ -380,17 +381,17 @@ func packAddr(address, port string) ([]interface{}, uint16) { ...@@ -380,17 +381,17 @@ func packAddr(address, port string) ([]interface{}, uint16) {
b, _ := strconv.Atoi(addr[1]) b, _ := strconv.Atoi(addr[1])
c, _ := strconv.Atoi(addr[2]) c, _ := strconv.Atoi(addr[2])
d, _ := strconv.Atoi(addr[3]) d, _ := strconv.Atoi(addr[3])
host := []interface{}{byte(a), byte(b), byte(c), byte(d)} host := []interface{}{int32(a), int32(b), int32(c), int32(d)}
prt, _ := strconv.Atoi(port) prt, _ := strconv.Atoi(port)
return host, uint16(prt) return host, uint16(prt)
} }
func unpackAddr(value *ethutil.RlpValue, p uint64) string { func unpackAddr(value *ethutil.Value, p uint64) string {
a := strconv.Itoa(int(value.Get(0).AsUint())) a := strconv.Itoa(int(value.Get(0).Uint()))
b := strconv.Itoa(int(value.Get(1).AsUint())) b := strconv.Itoa(int(value.Get(1).Uint()))
c := strconv.Itoa(int(value.Get(2).AsUint())) c := strconv.Itoa(int(value.Get(2).Uint()))
d := strconv.Itoa(int(value.Get(3).AsUint())) d := strconv.Itoa(int(value.Get(3).Uint()))
host := strings.Join([]string{a, b, c, d}, ".") host := strings.Join([]string{a, b, c, d}, ".")
port := strconv.Itoa(int(p)) port := strconv.Itoa(int(p))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment