move localRefCount accounting responsibility from Peer to Peers

This makes for a more symmetric API - Peers.FetchWithDefault does the
increment and Peers.Dereference does the decrement, whereas previously
the latter was done by Peer.DecrementLocalRefCount.

This does increase lock granularity, i.e. modifying any ref count now
requires a write lock on Peers.
This commit is contained in:
Matthias Radestock committed 2015-05-11 17:19:23 +01:00
1 parent 3e6eef5ebd
commit 505ced5cc8
5 files changed
+19 -45

No files matched your search

+1 -1
View File
@@ -412,7 +412,7 @@ func (conn *LocalConnection) shutdown(err error) {
}
if conn.remote != nil {
conn.remote.DecrementLocalRefCount()
conn.Router.Peers.Dereference(conn.remote)
conn.Router.Ourself.DeleteConnection(conn)
}