Remove unused code
This commit is contained in:
parent
5cfe54251a
commit
72c74f7800
20
client.go
20
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) {
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
package torrent
|
||||
|
||||
import "net"
|
||||
|
||||
type closeWrapper struct {
|
||||
net.Conn
|
||||
closer func() error
|
||||
}
|
||||
|
||||
func (me closeWrapper) Close() error {
|
||||
return me.closer()
|
||||
}
|
|
@ -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
|
||||
}
|
||||
|
|
11
piece.go
11
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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue