X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=peer-impl.go;h=f9f9096b198ea5d247d157fb940fbc9172ace1ac;hb=HEAD;hp=880b8f3543fe885d0c95a190f3d84e6127d737c0;hpb=6e97ce952f26a41e30c2a0049a9073d39659110d;p=btrtrc.git diff --git a/peer-impl.go b/peer-impl.go index 880b8f35..f9f9096b 100644 --- a/peer-impl.go +++ b/peer-impl.go @@ -1,6 +1,8 @@ package torrent import ( + "github.com/RoaringBitmap/roaring" + "github.com/anacrolix/torrent/metainfo" ) @@ -8,19 +10,28 @@ import ( // BitTorrent protocol connections. Some methods are underlined so as to avoid collisions with // legacy PeerConn methods. type peerImpl interface { - updateRequests() + // Trigger the actual request state to get updated + handleUpdateRequests() 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(Request) - _request(Request) - + // _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) + _request(Request) bool connectionFlags() string onClose() onGotInfo(*metainfo.Info) + // Drop connection. This may be a no-op if there is no connection. drop() + // Rebuke the peer + ban() String() string - connStatusString() string - writeBufferFull() bool + peerImplStatusLines() []string + + // 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 }