client.go | 20 -------------------- closewrapper.go | 12 ------------ peerconn.go | 8 -------- piece.go | 11 ----------- torrent.go | 8 -------- diff --git a/client.go b/client.go index fe1a876970d9c334aa3bd2374f7745b6202e48a5..b97c761492766549b98f3838e210f98df6bc821b 100644 --- a/client.go +++ b/client.go @@ -444,18 +444,6 @@ } return false } -func (cl *Client) waitAccept() { - for { - if cl.closed.IsSet() { - return - } - if cl.wantConns() { - return - } - cl.event.Wait() - } -} - // TODO: Apply filters for non-standard networks, particularly rate-limiting. func (cl *Client) rejectAccepted(conn net.Conn) error { if !cl.wantConns() { @@ -1425,14 +1413,6 @@ return ip } } return nil -} - -func (cl *Client) eachDialer(f func(Dialer) bool) { - for _, s := range cl.dialers { - if !f(s) { - break - } - } } func (cl *Client) eachListener(f func(Listener) bool) { diff --git a/closewrapper.go b/closewrapper.go deleted file mode 100644 index 5449418996852f706db36cd78d9d6a39cc717e60..0000000000000000000000000000000000000000 --- a/closewrapper.go +++ /dev/null @@ -1,12 +0,0 @@ -package torrent - -import "net" - -type closeWrapper struct { - net.Conn - closer func() error -} - -func (me closeWrapper) Close() error { - return me.closer() -} diff --git a/peerconn.go b/peerconn.go index 00131ea897e94b024073ca8f23b6e2d12aab65c0..5d1f718b55ba97e64c11ba97ab8bd92e08a61238 100644 --- a/peerconn.go +++ b/peerconn.go @@ -1583,10 +1583,6 @@ func (l connectionTrust) Less(r connectionTrust) bool { return multiless.New().Bool(l.Implicit, r.Implicit).Int64(l.NetGoodPiecesDirted, r.NetGoodPiecesDirted).Less() } -func (cn *Peer) peerMaxRequests() int { - return cn.PeerMaxRequests -} - // Returns the pieces the peer could have based on their claims. If we don't know how many pieces // are in the torrent, it could be a very large range the peer has sent HaveAll. func (cn *PeerConn) PeerPieces() bitmap.Bitmap { @@ -1606,10 +1602,6 @@ ret.AddRange(0, bitmap.ToEnd) } } return ret -} - -func (cn *Peer) pieceRequestOrder() *prioritybitmap.PriorityBitmap { - return &cn._pieceRequestOrder } func (cn *Peer) stats() *ConnStats { diff --git a/piece.go b/piece.go index 45b37c0aa2cd5d7337c90d7b87a1644907d2f733..398e7a70b6975445a4438916b1af6116472c86d6 100644 --- a/piece.go +++ b/piece.go @@ -115,13 +115,6 @@ func (p *Piece) chunkIndexSpec(chunk pp.Integer) ChunkSpec { return chunkIndexSpec(chunk, p.length(), p.chunkSize()) } -func (p *Piece) chunkIndexRequest(chunkIndex pp.Integer) Request { - return Request{ - pp.Integer(p.index), - p.chunkIndexSpec(chunkIndex), - } -} - func (p *Piece) numDirtyBytes() (ret pp.Integer) { // defer func() { // if ret > p.length() { @@ -235,10 +228,6 @@ } func (p *Piece) allChunksDirty() bool { return p._dirtyChunks.Len() == bitmap.BitRange(p.numChunks()) -} - -func (p *Piece) dirtyChunks() bitmap.Bitmap { - return p._dirtyChunks } func (p *Piece) State() PieceState { diff --git a/torrent.go b/torrent.go index 7d02539ac9f56b3b48244340215f7284884bc8fd..7fbcd2781f7589b5d437e5d1a85cdccae436bdd7 100644 --- a/torrent.go +++ b/torrent.go @@ -176,14 +176,6 @@ p.availability++ } } -func (t *Torrent) numConns() int { - return len(t.conns) -} - -func (t *Torrent) numReaders() int { - return len(t.readers) -} - func (t *Torrent) readerNowPieces() bitmap.Bitmap { return t._readerNowPieces }