aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/discover/table.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-04-18 07:50:31 +0800
committerFelix Lange <fjl@twurst.com>2015-04-30 20:57:33 +0800
commitfc747ef4a649cd90aec5193a8af6b7accb5eb03f (patch)
treeb81f4b1fb00abd2bf05b4d586b0b3f08d2011cd5 /p2p/discover/table.go
parent3fef60190384106af390dd23a65384b9cc6e4a28 (diff)
downloaddexon-fc747ef4a649cd90aec5193a8af6b7accb5eb03f.tar.gz
dexon-fc747ef4a649cd90aec5193a8af6b7accb5eb03f.tar.zst
dexon-fc747ef4a649cd90aec5193a8af6b7accb5eb03f.zip
p2p/discover: new endpoint format
This commit changes the discovery protocol to use the new "v4" endpoint format, which allows for separate UDP and TCP ports and makes it possible to discover the UDP address after NAT.
Diffstat (limited to 'p2p/discover/table.go')
-rw-r--r--p2p/discover/table.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/p2p/discover/table.go b/p2p/discover/table.go
index d3fe373f4..bbd40fde9 100644
--- a/p2p/discover/table.go
+++ b/p2p/discover/table.go
@@ -220,7 +220,7 @@ func (tab *Table) bondall(nodes []*Node) (result []*Node) {
rc := make(chan *Node, len(nodes))
for i := range nodes {
go func(n *Node) {
- nn, _ := tab.bond(false, n.ID, n.addr(), uint16(n.TCPPort))
+ nn, _ := tab.bond(false, n.ID, n.addr(), uint16(n.TCP))
rc <- nn
}(nodes[i])
}
@@ -299,12 +299,7 @@ func (tab *Table) pingpong(w *bondproc, pinged bool, id NodeID, addr *net.UDPAdd
tab.net.waitping(id)
}
// Bonding succeeded, update the node database
- w.n = &Node{
- ID: id,
- IP: addr.IP,
- DiscPort: addr.Port,
- TCPPort: int(tcpPort),
- }
+ w.n = &Node{ID: id, IP: addr.IP, UDP: uint16(addr.Port), TCP: tcpPort}
tab.db.updateNode(w.n)
close(w.done)
}