Some peerImpl observations
This commit is contained in:
parent
1e9d382af9
commit
133cc17c00
|
@ -14,7 +14,7 @@ type peerImpl interface {
|
|||
// Return true if there's room for more activity.
|
||||
request(request) bool
|
||||
connectionFlags() string
|
||||
_close()
|
||||
onClose()
|
||||
_postCancel(request)
|
||||
onGotInfo(*metainfo.Info)
|
||||
drop()
|
||||
|
|
|
@ -201,7 +201,7 @@ func (cn *peer) cumInterest() time.Duration {
|
|||
return ret
|
||||
}
|
||||
|
||||
func (cn *PeerConn) peerHasAllPieces() (all bool, known bool) {
|
||||
func (cn *peer) peerHasAllPieces() (all bool, known bool) {
|
||||
if cn.peerSentHaveAll {
|
||||
return true, true
|
||||
}
|
||||
|
@ -349,10 +349,10 @@ func (cn *peer) close() {
|
|||
}
|
||||
cn.discardPieceInclination()
|
||||
cn._pieceRequestOrder.Clear()
|
||||
cn.peerImpl._close()
|
||||
cn.peerImpl.onClose()
|
||||
}
|
||||
|
||||
func (cn *PeerConn) _close() {
|
||||
func (cn *PeerConn) onClose() {
|
||||
if cn.pex.IsEnabled() {
|
||||
cn.pex.Close()
|
||||
}
|
||||
|
|
|
@ -61,14 +61,15 @@ func (ws *webseedPeer) connectionFlags() string {
|
|||
return "WS"
|
||||
}
|
||||
|
||||
// TODO: This is called when banning peers. Perhaps we want to be able to ban webseeds too.
|
||||
// TODO: This is called when banning peers. Perhaps we want to be able to ban webseeds too. We could
|
||||
// return bool if this is even possible, and if it isn't, skip to the next drop candidate.
|
||||
func (ws *webseedPeer) drop() {}
|
||||
|
||||
func (ws *webseedPeer) updateRequests() {
|
||||
ws.peer.doRequestState()
|
||||
}
|
||||
|
||||
func (ws *webseedPeer) _close() {}
|
||||
func (ws *webseedPeer) onClose() {}
|
||||
|
||||
func (ws *webseedPeer) requestResultHandler(r request, webseedRequest webseed.Request) {
|
||||
result := <-webseedRequest.Result
|
||||
|
|
Loading…
Reference in New Issue