2
0
mirror of synced 2025-02-24 14:48:27 +00:00
torrent/peer-impl.go
Matt Joiner ff3c186396 Add low requests check
This is an optimization for webseeds, which have 10 synchronous request routines, and if the request count dips below 10, some sit idle. There is probably something similar to be done with PeerConns, which won't update until there are zero requests, but there there is a timer to refresh updates, and the queues are very long (typically 512-2048).
2021-10-21 10:48:43 +11:00

29 lines
870 B
Go

package torrent
import (
"github.com/anacrolix/torrent/metainfo"
)
// Contains implementation details that differ between peer types, like Webseeds and regular
// BitTorrent protocol connections. Some methods are underlined so as to avoid collisions with
// legacy PeerConn methods.
type peerImpl interface {
// Trigger the actual request state to get updated
handleUpdateRequests()
// Whether the outstanding local request cardinality is low enough to warrant an update.
isLowOnRequests() bool
writeInterested(interested bool) bool
// Neither of these return buffer room anymore, because they're currently both posted. There's
// also PeerConn.writeBufferFull for when/where it matters.
_cancel(RequestIndex) bool
_request(Request) bool
connectionFlags() string
onClose()
onGotInfo(*metainfo.Info)
drop()
String() string
connStatusString() string
}