Remove unused functions
This commit is contained in:
parent
dfb7f5b00c
commit
a8a1ea755d
|
@ -515,13 +515,6 @@ func (cl *Client) initiateConn(peer Peer, t *Torrent) {
|
|||
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(),
|
||||
|
|
|
@ -1014,12 +1014,6 @@ func addClientPeer(t *Torrent, cl *Client) {
|
|||
})
|
||||
}
|
||||
|
||||
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()
|
||||
|
|
|
@ -547,26 +547,6 @@ func (cn *connection) updateRequests() {
|
|||
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 {
|
||||
|
|
|
@ -101,10 +101,6 @@ func (r *Reader) available(off, max int64) (ret int64) {
|
|||
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.
|
||||
|
|
|
@ -640,13 +640,6 @@ func (t *Torrent) hashPiece(piece int) (ret metainfo.Hash) {
|
|||
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) {
|
||||
|
|
Loading…
Reference in New Issue