From: Matt Joiner <anacrolix@gmail.com>
Date: Thu, 19 Aug 2021 06:06:46 +0000 (+1000)
Subject: Remove unused code
X-Git-Tag: v1.30.3~1
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=72c74f7800c1a38be12d6cf9842697e8f92748af;p=btrtrc.git

Remove unused code
---

diff --git a/client.go b/client.go
index fe1a8769..b97c7614 100644
--- 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
index 54494189..00000000
--- 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 00131ea8..5d1f718b 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 {
@@ -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
 }
diff --git a/piece.go b/piece.go
index 45b37c0a..398e7a70 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() {
@@ -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)
 }
diff --git a/torrent.go b/torrent.go
index 7d02539a..7fbcd278 100644
--- a/torrent.go
+++ b/torrent.go
@@ -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
 }