Commit c100390a authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

bitswap engine: signal in own func

parent 62362584
......@@ -143,13 +143,10 @@ func (e *Engine) MessageReceived(p peer.ID, m bsmsg.BitSwapMessage) error {
newWorkExists := false
defer func() {
if newWorkExists {
// Signal task generation to restart (if stopped!)
select {
case e.workSignal <- struct{}{}:
default:
}
e.signalNewWork()
}
}()
e.lock.Lock()
defer e.lock.Unlock()
......@@ -222,3 +219,11 @@ func (e *Engine) findOrCreate(p peer.ID) *ledger {
}
return l
}
func (e *Engine) signalNewWork() {
// Signal task generation to restart (if stopped!)
select {
case e.workSignal <- struct{}{}:
default:
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment