Commit e3f251bf authored by Jeromy's avatar Jeromy

fix some logic

parent a45f185a
...@@ -89,14 +89,15 @@ func (tl *prq) Pop() *peerRequestTask { ...@@ -89,14 +89,15 @@ func (tl *prq) Pop() *peerRequestTask {
out = partner.taskQueue.Pop().(*peerRequestTask) out = partner.taskQueue.Pop().(*peerRequestTask)
delete(tl.taskMap, out.Key()) delete(tl.taskMap, out.Key())
if out.trash { if out.trash {
out = nil
continue // discarding tasks that have been removed continue // discarding tasks that have been removed
} }
partner.StartTask()
partner.requests--
break // and return |out| break // and return |out|
} }
// start the new task, and push the partner back onto the queue
partner.StartTask()
partner.requests--
tl.pQueue.Push(partner) tl.pQueue.Push(partner)
return out return out
} }
......
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