1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 23:42:20 +08:00

move blocking calls out of single threaded loops, cancel contexts ASAP

This commit is contained in:
Jeromy
2015-02-19 00:31:10 +00:00
parent fa3a9e2ec9
commit a29c0fc751
4 changed files with 79 additions and 29 deletions

View File

@ -228,6 +228,10 @@ func (e *Engine) MessageSent(p peer.ID, m bsmsg.BitSwapMessage) error {
return nil
}
func (e *Engine) PeerDisconnected(p peer.ID) {
// TODO: release ledger
}
func (e *Engine) numBytesSentTo(p peer.ID) uint64 {
// NB not threadsafe
return e.findOrCreate(p).Accounting.BytesSent