]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Remove unused code
authorMatt Joiner <anacrolix@gmail.com>
Thu, 19 Aug 2021 06:06:46 +0000 (16:06 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 19 Aug 2021 06:06:46 +0000 (16:06 +1000)
client.go
closewrapper.go [deleted file]
peerconn.go
piece.go
torrent.go

index fe1a876970d9c334aa3bd2374f7745b6202e48a5..b97c761492766549b98f3838e210f98df6bc821b 100644 (file)
--- a/client.go
+++ b/client.go
@@ -444,18 +444,6 @@ func (cl *Client) wantConns() bool {
        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() {
@@ -1427,14 +1415,6 @@ func firstNotNil(ips ...net.IP) net.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) {
        for _, s := range cl.listeners {
                if !f(s) {
diff --git a/closewrapper.go b/closewrapper.go
deleted file mode 100644 (file)
index 5449418..0000000
+++ /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()
-}
index 00131ea897e94b024073ca8f23b6e2d12aab65c0..5d1f718b55ba97e64c11ba97ab8bd92e08a61238 100644 (file)
@@ -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 {
@@ -1608,10 +1604,6 @@ func (cn *Peer) newPeerPieces() bitmap.Bitmap {
        return ret
 }
 
-func (cn *Peer) pieceRequestOrder() *prioritybitmap.PriorityBitmap {
-       return &cn._pieceRequestOrder
-}
-
 func (cn *Peer) stats() *ConnStats {
        return &cn._stats
 }
index 45b37c0aa2cd5d7337c90d7b87a1644907d2f733..398e7a70b6975445a4438916b1af6116472c86d6 100644 (file)
--- 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() {
@@ -237,10 +230,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 {
        return p.t.PieceState(p.index)
 }
index 7d02539ac9f56b3b48244340215f7284884bc8fd..7fbcd2781f7589b5d437e5d1a85cdccae436bdd7 100644 (file)
@@ -176,14 +176,6 @@ func (t *Torrent) incPieceAvailability(i pieceIndex) {
        }
 }
 
-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
 }