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