2020-06-02 15:41:59 +08:00
|
|
|
package torrent
|
|
|
|
|
|
|
|
import (
|
2021-11-12 09:37:40 +08:00
|
|
|
"github.com/RoaringBitmap/roaring"
|
2020-06-02 15:41:59 +08:00
|
|
|
"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 {
|
2021-10-21 07:28:57 +08:00
|
|
|
// Trigger the actual request state to get updated
|
|
|
|
handleUpdateRequests()
|
2020-06-02 15:41:59 +08:00
|
|
|
writeInterested(interested bool) bool
|
2021-05-09 21:38:38 +08:00
|
|
|
|
2021-12-11 21:04:06 +08:00
|
|
|
// _cancel initiates cancellation of a request and returns acked if it expects the cancel to be
|
|
|
|
// handled by a follow-up event.
|
|
|
|
_cancel(RequestIndex) (acked bool)
|
2021-05-20 18:23:45 +08:00
|
|
|
_request(Request) bool
|
2020-06-02 15:41:59 +08:00
|
|
|
connectionFlags() string
|
2021-01-04 12:51:23 +08:00
|
|
|
onClose()
|
2020-06-02 15:41:59 +08:00
|
|
|
onGotInfo(*metainfo.Info)
|
|
|
|
drop()
|
2020-06-04 09:50:20 +08:00
|
|
|
String() string
|
2020-09-29 14:21:54 +08:00
|
|
|
connStatusString() string
|
2021-11-12 09:37:40 +08:00
|
|
|
|
|
|
|
// All if the peer should have everything, known if we know that for a fact. For example, we can
|
|
|
|
// guess at how many pieces are in a torrent, and assume they have all pieces based on them
|
|
|
|
// having sent haves for everything, but we don't know for sure. But if they send a have-all
|
|
|
|
// message, then it's clear that they do.
|
|
|
|
peerHasAllPieces() (all, known bool)
|
|
|
|
peerPieces() *roaring.Bitmap
|
2020-06-02 15:41:59 +08:00
|
|
|
}
|