提交 181ff4ea 作者: Brian Tiger Chow 提交者: Juan Batiz-Benet

tq.Cancel -> tq.Remove

License: MIT
Signed-off-by: 's avatarBrian Tiger Chow <brian@perfmode.com>
上级 198aa195
......@@ -124,7 +124,7 @@ func (lm *LedgerManager) MessageReceived(p peer.Peer, m bsmsg.BitSwapMessage) er
for _, e := range m.Wantlist() {
if e.Cancel {
l.CancelWant(e.Key)
lm.taskqueue.Cancel(e.Key, p)
lm.taskqueue.Remove(e.Key, p)
} else {
l.Wants(e.Key, e.Priority)
newWorkExists = true
......@@ -159,7 +159,7 @@ func (lm *LedgerManager) MessageSent(p peer.Peer, m bsmsg.BitSwapMessage) error
for _, block := range m.Blocks() {
l.SentBytes(len(block.Data))
l.wantList.Remove(block.Key())
lm.taskqueue.Cancel(block.Key(), p)
lm.taskqueue.Remove(block.Key(), p)
}
return nil
......
......@@ -62,8 +62,8 @@ func (tl *taskQueue) Pop() *Task {
return out
}
// Cancel lazily cancels the sending of a block to a given peer
func (tl *taskQueue) Cancel(k u.Key, p peer.Peer) {
// Remove lazily removes a task from the queue
func (tl *taskQueue) Remove(k u.Key, p peer.Peer) {
t, ok := tl.taskmap[taskKey(p, k)]
if ok {
t.theirPriority = -1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论