Improve logging heuristic for sending chunks of pieces that go missing
This commit is contained in:
parent
cd1c1a9fed
commit
40a78b7cdd
12
client.go
12
client.go
@ -1087,11 +1087,15 @@ another:
|
||||
for r := range c.PeerRequests {
|
||||
err := cl.sendChunk(t, c, r)
|
||||
if err != nil {
|
||||
if t.pieceComplete(int(r.Index)) && err == io.ErrUnexpectedEOF {
|
||||
// We had the piece, but not anymore.
|
||||
} else {
|
||||
log.Printf("error sending chunk %+v to peer: %s", r, err)
|
||||
i := int(r.Index)
|
||||
if t.pieceComplete(i) {
|
||||
t.updatePieceCompletion(i)
|
||||
if !t.pieceComplete(i) {
|
||||
// We had the piece, but not anymore.
|
||||
break another
|
||||
}
|
||||
}
|
||||
log.Printf("error sending chunk %+v to peer: %s", r, err)
|
||||
// If we failed to send a chunk, choke the peer to ensure they
|
||||
// flush all their requests. We've probably dropped a piece,
|
||||
// but there's no way to communicate this to the peer. If they
|
||||
|
Loading…
x
Reference in New Issue
Block a user