Branch: refs/heads/master
Home: https://github.com/btcsuite/btcd
Commit: d0f0a2ac02596ff312987fa1fe75972e5bf9a227
https://github.com/btcsuite/btcd/commit/d0f0a2ac02596ff312987fa1fe75972e5bf9a227
Author: Dave Collins <[email protected]>
Date: 2015-11-23 (Mon, 23 Nov 2015)
Changed paths:
M server.go
Log Message:
-----------
server: Improve handling of disconnected peers.
When the peer code was refactored, the lists of peers were converted to
maps however the code which runs when a peer disconnects still iterates
them like a slice. This is no longer necessary since they are maps
which means the peer can simply be looked up by its ID.
Also, the old code was comparing the map entry and the peer being
removed by their pointers which could lead to potentially not properly
finding the peer. This issue is also resolved by this change since it
looks up the peer by its ID.