浏览代码

eth/downloader: remove the expired id directly (#17963)

Wenbiao Zheng 7 年之前
父节点
当前提交
b35165555d
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      eth/downloader/queue.go

+ 3 - 4
eth/downloader/queue.go

@@ -664,12 +664,11 @@ func (q *queue) expire(timeout time.Duration, pendPool map[string]*fetchRequest,
 			}
 			// Add the peer to the expiry report along the number of failed requests
 			expiries[id] = len(request.Headers)
+
+			// Remove the expired requests from the pending pool directly
+			delete(pendPool, id)
 		}
 	}
-	// Remove the expired requests from the pending pool
-	for id := range expiries {
-		delete(pendPool, id)
-	}
 	return expiries
 }