|
|
@ -564,26 +564,29 @@ func (q *queue) reserveHeaders(p *peerConnection, count int, taskPool map[common |
|
|
|
|
|
|
|
|
|
|
|
// CancelHeaders aborts a fetch request, returning all pending skeleton indexes to the queue.
|
|
|
|
// CancelHeaders aborts a fetch request, returning all pending skeleton indexes to the queue.
|
|
|
|
func (q *queue) CancelHeaders(request *fetchRequest) { |
|
|
|
func (q *queue) CancelHeaders(request *fetchRequest) { |
|
|
|
|
|
|
|
q.lock.Lock() |
|
|
|
|
|
|
|
defer q.lock.Unlock() |
|
|
|
q.cancel(request, q.headerTaskQueue, q.headerPendPool) |
|
|
|
q.cancel(request, q.headerTaskQueue, q.headerPendPool) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// CancelBodies aborts a body fetch request, returning all pending headers to the
|
|
|
|
// CancelBodies aborts a body fetch request, returning all pending headers to the
|
|
|
|
// task queue.
|
|
|
|
// task queue.
|
|
|
|
func (q *queue) CancelBodies(request *fetchRequest) { |
|
|
|
func (q *queue) CancelBodies(request *fetchRequest) { |
|
|
|
|
|
|
|
q.lock.Lock() |
|
|
|
|
|
|
|
defer q.lock.Unlock() |
|
|
|
q.cancel(request, q.blockTaskQueue, q.blockPendPool) |
|
|
|
q.cancel(request, q.blockTaskQueue, q.blockPendPool) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// CancelReceipts aborts a body fetch request, returning all pending headers to
|
|
|
|
// CancelReceipts aborts a body fetch request, returning all pending headers to
|
|
|
|
// the task queue.
|
|
|
|
// the task queue.
|
|
|
|
func (q *queue) CancelReceipts(request *fetchRequest) { |
|
|
|
func (q *queue) CancelReceipts(request *fetchRequest) { |
|
|
|
|
|
|
|
q.lock.Lock() |
|
|
|
|
|
|
|
defer q.lock.Unlock() |
|
|
|
q.cancel(request, q.receiptTaskQueue, q.receiptPendPool) |
|
|
|
q.cancel(request, q.receiptTaskQueue, q.receiptPendPool) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Cancel aborts a fetch request, returning all pending hashes to the task queue.
|
|
|
|
// Cancel aborts a fetch request, returning all pending hashes to the task queue.
|
|
|
|
func (q *queue) cancel(request *fetchRequest, taskQueue *prque.Prque, pendPool map[string]*fetchRequest) { |
|
|
|
func (q *queue) cancel(request *fetchRequest, taskQueue *prque.Prque, pendPool map[string]*fetchRequest) { |
|
|
|
q.lock.Lock() |
|
|
|
|
|
|
|
defer q.lock.Unlock() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if request.From > 0 { |
|
|
|
if request.From > 0 { |
|
|
|
taskQueue.Push(request.From, -int64(request.From)) |
|
|
|
taskQueue.Push(request.From, -int64(request.From)) |
|
|
|
} |
|
|
|
} |
|
|
|