Skip to content

Commit

Permalink
update const per host
Browse files Browse the repository at this point in the history
  • Loading branch information
mh0lt committed Jul 22, 2024
1 parent db0b955 commit e00524b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ func (cl *Client) init(cfg *ClientConfig) {
DialContext: cfg.HTTPDialContext,
// I think this value was observed from some webseeds. It seems reasonable to extend it
// to other uses of HTTP from the client.
MaxConnsPerHost: 10,
// This has been updated as under heavy load the golang http lib seems to panic, MaxIdleConnsPerHost
// is set to stop the http runtime recycling sockets
MaxConnsPerHost: 50,
MaxIdleConnsPerHost: 25,
}
}
}
Expand Down Expand Up @@ -1249,7 +1252,7 @@ func (cl *Client) gotMetadataExtensionMsg(payload []byte, t *Torrent, c *PeerCon
if !c.requestedMetadataPiece(piece) {
return fmt.Errorf("got unexpected piece %d", piece)
}

c.mu.Lock()
c.metadataRequests[piece] = false
c.lastUsefulChunkReceived = time.Now()
Expand All @@ -1260,7 +1263,7 @@ func (cl *Client) gotMetadataExtensionMsg(payload []byte, t *Torrent, c *PeerCon
return fmt.Errorf("data has bad offset in payload: %d", begin)
}
t.saveMetadataPiece(piece, payload[begin:])

err = t.maybeCompleteMetadata()
if err != nil {
// Log this at the Torrent-level, as we don't partition metadata by Peer yet, so we
Expand Down

0 comments on commit e00524b

Please sign in to comment.