client.go | 7 ------- client_test.go | 6 ------ connection.go | 20 -------------------- reader.go | 4 ---- torrent.go | 7 ------- diff --git a/client.go b/client.go index c451aca6732f9c903929256c2723b27605ecedc4..035af50d3107990b21c21563706745855ed49d1c 100644 --- a/client.go +++ b/client.go @@ -515,13 +515,6 @@ t.halfOpen[addr] = struct{}{} go cl.outgoingConnection(t, addr, peer.Source) } -func (cl *Client) dialTimeout(t *Torrent) time.Duration { - cl.mu.Lock() - pendingPeers := len(t.peers) - cl.mu.Unlock() - return reducedDialTimeout(nominalDialTimeout, cl.halfOpenLimit, pendingPeers) -} - func (cl *Client) dialTCP(ctx context.Context, addr string) (c net.Conn, err error) { d := net.Dialer{ // LocalAddr: cl.tcpListener.Addr(), diff --git a/client_test.go b/client_test.go index b74a65a716bae1e056181c19166d044dbc7b9f02..e786b3994257fb437f618e1616d2a8b0f21373c2 100644 --- a/client_test.go +++ b/client_test.go @@ -1014,12 +1014,6 @@ }, }) } -func printConnPeerCounts(t *Torrent) { - t.cl.mu.Lock() - log.Println(len(t.conns), len(t.peers)) - t.cl.mu.Unlock() -} - func totalConns(tts []*Torrent) (ret int) { for _, tt := range tts { tt.cl.mu.Lock() diff --git a/connection.go b/connection.go index a893ccb81ad6296f4ffe466b6791c266b2dba4bb..0b1fed8173834269fa438307604eac33ed2bc858 100644 --- a/connection.go +++ b/connection.go @@ -547,26 +547,6 @@ } cn.SetInterested(i) } -func (cn *connection) fillRequests() { - cn.pieceRequestOrder.IterTyped(func(piece int) (more bool) { - if cn.t.cl.config.Debug && cn.t.havePiece(piece) { - panic(piece) - } - return cn.requestPiecePendingChunks(piece) - }) -} - -func (c *connection) requestPiecePendingChunks(piece int) (again bool) { - if !c.PeerHasPiece(piece) { - return true - } - chunkIndices := c.t.pieces[piece].undirtiedChunkIndices().ToSortedSlice() - return iter.ForPerm(len(chunkIndices), func(i int) bool { - req := request{pp.Integer(piece), c.t.chunkIndexSpec(chunkIndices[i], piece)} - return c.Request(req) - }) -} - func undirtiedChunks(piece int, t *Torrent, f func(chunkSpec) bool) bool { chunkIndices := t.pieces[piece].undirtiedChunkIndices().ToSortedSlice() return iter.ForPerm(len(chunkIndices), func(i int) bool { diff --git a/reader.go b/reader.go index ed4da8aa3be30460faa7e660d036ee634895eee8..33ed4017dbc46e70ed49a552317b432d3ee244b1 100644 --- a/reader.go +++ b/reader.go @@ -101,10 +101,6 @@ } return } -func (r *Reader) tickleClient() { - r.t.readersChanged() -} - func (r *Reader) waitReadable(off int64) { // We may have been sent back here because we were told we could read but // it failed. diff --git a/torrent.go b/torrent.go index d361bd6e338828f0289b934d4d7dd7ae5b5d3ad0..c2be1f0610649174410a52ef8e3c26c7ad435b5f 100644 --- a/torrent.go +++ b/torrent.go @@ -640,13 +640,6 @@ } return } -func (t *Torrent) haveAllPieces() bool { - if !t.haveInfo() { - return false - } - return t.completedPieces.Len() == t.numPieces() -} - func (t *Torrent) haveAnyPieces() bool { for i := range t.pieces { if t.pieceComplete(i) {