Skip to content

Commit

Permalink
p2p: fix call to Server.removePeer (might help with ethereum#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Dec 15, 2014
1 parent b55fabc commit aa3b91b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,7 @@ func (srv *Server) Stop() {

func (srv *Server) discLoop() {
for peer := range srv.peerDisconnect {
// peer has just disconnected. free up its slot.
srvlog.Infof("%v is gone", peer)
srv.peerSlots <- peer.slot
srv.lock.Lock()
srv.peers[peer.slot] = nil
srv.lock.Unlock()
srv.removePeer(peer)
}
}

Expand Down Expand Up @@ -384,7 +379,7 @@ func (srv *Server) addPeer(conn net.Conn, desc *peerAddr, slot int) *Peer {
func (srv *Server) removePeer(peer *Peer) {
srv.lock.Lock()
defer srv.lock.Unlock()
srvlog.Debugf("Removing peer %v %v (slot %v)\n", peer, peer.slot)
srvlog.Debugf("Removing %v (slot %v)\n", peer, peer.slot)
if srv.peers[peer.slot] != peer {
srvlog.Warnln("Invalid peer to remove:", peer)
return
Expand Down

0 comments on commit aa3b91b

Please sign in to comment.