diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-06 00:10:42 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-06 00:10:42 +0800 |
commit | 6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2 (patch) | |
tree | b898711590694cfaa6f10dbc2a4c8591232954ef /p2p/server.go | |
parent | b0854fbff5c3d588134f577918a39d08002235dc (diff) | |
download | dexon-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar dexon-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.gz dexon-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.bz2 dexon-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.lz dexon-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.xz dexon-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.zst dexon-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.zip |
Merge
Diffstat (limited to 'p2p/server.go')
-rw-r--r-- | p2p/server.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/p2p/server.go b/p2p/server.go index 326781234..cfff442f7 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -113,9 +113,11 @@ func (srv *Server) PeerCount() int { // SuggestPeer injects an address into the outbound address pool. func (srv *Server) SuggestPeer(ip net.IP, port int, nodeID []byte) { + addr := &peerAddr{ip, uint64(port), nodeID} select { - case srv.peerConnect <- &peerAddr{ip, uint64(port), nodeID}: + case srv.peerConnect <- addr: default: // don't block + srvlog.Warnf("peer suggestion %v ignored", addr) } } @@ -258,6 +260,7 @@ func (srv *Server) listenLoop() { for { select { case slot := <-srv.peerSlots: + srvlog.Debugf("grabbed slot %v for listening", slot) conn, err := srv.listener.Accept() if err != nil { srv.peerSlots <- slot @@ -330,6 +333,7 @@ func (srv *Server) dialLoop() { case desc := <-suggest: // candidate peer found, will dial out asyncronously // if connection fails slot will be released + srvlog.Infof("dial %v (%v)", desc, *slot) go srv.dialPeer(desc, *slot) // we can watch if more peers needed in the next loop slots = srv.peerSlots |