aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <obscuren@users.noreply.github.com>2014-12-16 05:50:05 +0800
committerJeffrey Wilcke <obscuren@users.noreply.github.com>2014-12-16 05:50:05 +0800
commitbb17591959b530c72d76b554002574a9d5ecb424 (patch)
tree89fd556690a486e6a95ea11330bea556ef8eb518
parentb55fabc7be4debff147b0598eea39f9d16cfa108 (diff)
parentaa3b91b8026c665ee53f768f8b94c3abe1713bf6 (diff)
downloaddexon-bb17591959b530c72d76b554002574a9d5ecb424.tar
dexon-bb17591959b530c72d76b554002574a9d5ecb424.tar.gz
dexon-bb17591959b530c72d76b554002574a9d5ecb424.tar.bz2
dexon-bb17591959b530c72d76b554002574a9d5ecb424.tar.lz
dexon-bb17591959b530c72d76b554002574a9d5ecb424.tar.xz
dexon-bb17591959b530c72d76b554002574a9d5ecb424.tar.zst
dexon-bb17591959b530c72d76b554002574a9d5ecb424.zip
Merge pull request #211 from fjl/fix-server-disc
p2p: fix call to Server.removePeer
-rw-r--r--p2p/server.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/p2p/server.go b/p2p/server.go
index 9353e12ea..326781234 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -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)
}
}
@@ -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