client.go | 7 ++----- diff --git a/client.go b/client.go index b21fb5223f6a04b49af191d3a1a6446b1c1f33aa..06c1652e6b7084afc3166bcc6ecbef2ea1ba36d8 100644 --- a/client.go +++ b/client.go @@ -337,8 +337,8 @@ } func (cl *Client) raisePiecePriority(t *torrent, piece int, priority piecePriority) { if t.Pieces[piece].Priority < priority { - cl.event.Broadcast() cl.prioritizePiece(t, piece, priority) + cl.event.Broadcast() } } @@ -2552,6 +2552,7 @@ // TODO: Check this isn't called more than once for each piece being correct. func (me *Client) pieceChanged(t *torrent, piece int) { correct := t.pieceComplete(piece) p := t.Pieces[piece] + defer p.Event.Broadcast() if correct { p.Priority = PiecePriorityNone p.PendingChunkSpecs = nil @@ -2560,7 +2561,6 @@ if int(req.Index) == piece { delete(t.urgent, req) } } - p.Event.Broadcast() } else { if p.numPendingChunks() == 0 { t.pendAllChunkSpecs(int(piece)) @@ -2587,9 +2587,6 @@ if t.wantPiece(piece) && conn.PeerHasPiece(piece) { t.connPendPiece(conn, int(piece)) me.replenishConnRequests(t, conn) } - } - if t.haveAllPieces() && me.config.NoUpload { - t.ceaseNetworking() } me.event.Broadcast() }