aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/server.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-06 00:10:42 +0800
committerobscuren <geffobscura@gmail.com>2015-01-06 00:10:42 +0800
commit6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2 (patch)
treeb898711590694cfaa6f10dbc2a4c8591232954ef /p2p/server.go
parentb0854fbff5c3d588134f577918a39d08002235dc (diff)
downloadgo-tangerine-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar
go-tangerine-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.gz
go-tangerine-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.bz2
go-tangerine-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.lz
go-tangerine-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.xz
go-tangerine-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.tar.zst
go-tangerine-6abf8ef78f1474fdeb7a6a6ce084bf994cc055f2.zip
Merge
Diffstat (limited to 'p2p/server.go')
-rw-r--r--p2p/server.go6
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