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() {
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) {
+++ /dev/null
-package torrent
-
-import "net"
-
-type closeWrapper struct {
- net.Conn
- closer func() error
-}
-
-func (me closeWrapper) Close() error {
- return me.closer()
-}
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 {
return ret
}
-func (cn *Peer) pieceRequestOrder() *prioritybitmap.PriorityBitmap {
- return &cn._pieceRequestOrder
-}
-
func (cn *Peer) stats() *ConnStats {
return &cn._stats
}
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() {
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)
}
}
}
-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
}