From 20de43a42cd3af55b434a68621e6a6304a83e55f Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 11 Mar 2019 10:45:43 +1100 Subject: [PATCH] Panic on chunk write errors The torrent client will download indefinitely when this occurs, a strategy to handle or raise the error more appropriately is required. --- connection.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connection.go b/connection.go index 85f462a3..28152d5a 100644 --- a/connection.go +++ b/connection.go @@ -1338,7 +1338,7 @@ func (c *connection) receiveChunk(msg *pp.Message) error { piece.decrementPendingWrites() if err != nil { - c.t.logger.Printf("%s (%s): error writing chunk %v: %s", t, t.infoHash, req, err) + panic(fmt.Sprintf("error writing chunk: %v", err)) t.pendRequest(req) t.updatePieceCompletion(pieceIndex(msg.Index)) return nil -- 2.48.1