]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Remove unused functions
authorMatt Joiner <anacrolix@gmail.com>
Sat, 26 Aug 2017 03:23:04 +0000 (13:23 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sat, 26 Aug 2017 03:23:04 +0000 (13:23 +1000)
client.go
client_test.go
connection.go
reader.go
torrent.go

index c451aca6732f9c903929256c2723b27605ecedc4..035af50d3107990b21c21563706745855ed49d1c 100644 (file)
--- a/client.go
+++ b/client.go
@@ -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(),
index b74a65a716bae1e056181c19166d044dbc7b9f02..e786b3994257fb437f618e1616d2a8b0f21373c2 100644 (file)
@@ -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()
index a893ccb81ad6296f4ffe466b6791c266b2dba4bb..0b1fed8173834269fa438307604eac33ed2bc858 100644 (file)
@@ -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 {
index ed4da8aa3be30460faa7e660d036ee634895eee8..33ed4017dbc46e70ed49a552317b432d3ee244b1 100644 (file)
--- a/reader.go
+++ b/reader.go
@@ -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.
index d361bd6e338828f0289b934d4d7dd7ae5b5d3ad0..c2be1f0610649174410a52ef8e3c26c7ad435b5f 100644 (file)
@@ -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) {