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:
1 parent
3e6eef5ebd
commit
505ced5cc8
5 files changed
+19
-45
No files matched your search
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user