aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/server.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-02-06 21:40:53 +0800
committerFelix Lange <fjl@twurst.com>2015-02-07 07:12:23 +0800
commit8564eb9f7efcc7a0e639f6a45d7e67037fedac5f (patch)
tree2b2ebde612d7d084b87b3eff9b6db0e08ea552ed /p2p/server.go
parent56f777b2fc77275bc636562b66a08b19afe2ec56 (diff)
downloadgo-tangerine-8564eb9f7efcc7a0e639f6a45d7e67037fedac5f.tar
go-tangerine-8564eb9f7efcc7a0e639f6a45d7e67037fedac5f.tar.gz
go-tangerine-8564eb9f7efcc7a0e639f6a45d7e67037fedac5f.tar.bz2
go-tangerine-8564eb9f7efcc7a0e639f6a45d7e67037fedac5f.tar.lz
go-tangerine-8564eb9f7efcc7a0e639f6a45d7e67037fedac5f.tar.xz
go-tangerine-8564eb9f7efcc7a0e639f6a45d7e67037fedac5f.tar.zst
go-tangerine-8564eb9f7efcc7a0e639f6a45d7e67037fedac5f.zip
p2p/discover: add node URL functions, distinguish TCP/UDP ports
The discovery RPC protocol does not yet distinguish TCP and UDP ports. But it can't hurt to do so in our internal model.
Diffstat (limited to 'p2p/server.go')
-rw-r--r--p2p/server.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/p2p/server.go b/p2p/server.go
index 9b8030541..87be97a2f 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -136,7 +136,7 @@ func (srv *Server) PeerCount() int {
// SuggestPeer creates a connection to the given Node if it
// is not already connected.
func (srv *Server) SuggestPeer(ip net.IP, port int, id discover.NodeID) {
- srv.peerConnect <- &discover.Node{ID: id, Addr: &net.UDPAddr{IP: ip, Port: port}}
+ srv.peerConnect <- &discover.Node{ID: id, IP: ip, TCPPort: port}
}
// Broadcast sends an RLP-encoded message to all connected peers.
@@ -364,8 +364,9 @@ func (srv *Server) dialLoop() {
}
func (srv *Server) dialNode(dest *discover.Node) {
- srvlog.Debugf("Dialing %v\n", dest.Addr)
- conn, err := srv.Dialer.Dial("tcp", dest.Addr.String())
+ addr := &net.TCPAddr{IP: dest.IP, Port: dest.TCPPort}
+ srvlog.Debugf("Dialing %v\n", dest)
+ conn, err := srv.Dialer.Dial("tcp", addr.String())
if err != nil {
srvlog.DebugDetailf("dial error: %v", err)
return