add some logging to server dialout and ignored peer suggestion

This commit is contained in:
zelig 2015-01-02 20:33:58 +00:00
parent 470812464e
commit f129798a77

View file

@ -113,9 +113,11 @@ func (srv *Server) PeerCount() int {
// SuggestPeer injects an address into the outbound address pool. // SuggestPeer injects an address into the outbound address pool.
func (srv *Server) SuggestPeer(ip net.IP, port int, nodeID []byte) { func (srv *Server) SuggestPeer(ip net.IP, port int, nodeID []byte) {
addr := &peerAddr{ip, uint64(port), nodeID}
select { select {
case srv.peerConnect <- &peerAddr{ip, uint64(port), nodeID}: case srv.peerConnect <- addr:
default: // don't block default: // don't block
srvlog.Warnf("peer suggestion %v ignored", addr)
} }
} }
@ -330,6 +332,7 @@ func (srv *Server) dialLoop() {
case desc := <-suggest: case desc := <-suggest:
// candidate peer found, will dial out asyncronously // candidate peer found, will dial out asyncronously
// if connection fails slot will be released // if connection fails slot will be released
srvlog.Infof("dial %v (%v)", desc, *slot)
go srv.dialPeer(desc, *slot) go srv.dialPeer(desc, *slot)
// we can watch if more peers needed in the next loop // we can watch if more peers needed in the next loop
slots = srv.peerSlots slots = srv.peerSlots