From: Matt Joiner Date: Thu, 15 Oct 2020 01:45:19 +0000 (+1100) Subject: We might want to close webseed peers on response errors X-Git-Tag: v1.18.0~3 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=0b726a899b169a2f670ed5fcdceb5f67c10c2ed8;p=btrtrc.git We might want to close webseed peers on response errors --- diff --git a/webseed-peer.go b/webseed-peer.go index 064a197c..4ed32372 100644 --- a/webseed-peer.go +++ b/webseed-peer.go @@ -76,7 +76,11 @@ func (ws *webseedPeer) requestResultHandler(r request, webseedRequest webseed.Re defer ws.peer.t.cl.unlock() if result.Err != nil { ws.peer.logger.Printf("request %v rejected: %v", r, result.Err) - if strings.Contains(errors.Cause(result.Err).Error(), "unsupported protocol scheme") { + // Always close for now. We need to filter out temporary errors, but this is a nightmare in + // Go. Currently a bad webseed URL can starve out the good ones due to the chunk selection + // algorithm. + const closeOnAllErrors = false + if closeOnAllErrors || strings.Contains(errors.Cause(result.Err).Error(), "unsupported protocol scheme") { ws.peer.close() } else { ws.peer.remoteRejectedRequest(r)