Transmission does not reject cancelled requests

This commit is contained in:
Matt Joiner 2021-12-07 14:16:02 +11:00
parent 388bfafa01
commit 96ef73aeb6
1 changed files with 7 additions and 1 deletions

View File

@ -648,7 +648,9 @@ func (me *PeerConn) _cancel(r RequestIndex) bool {
// Already cancelled and waiting for a response.
return true
}
if me.fastEnabled() {
// Transmission does not send rejects for received cancels. See
// https://github.com/transmission/transmission/pull/2275.
if me.fastEnabled() && !me.remoteIsTransmission() {
me.cancelledRequests.Add(r)
} else {
if !me.deleteRequest(r) {
@ -1688,3 +1690,7 @@ func (p *Peer) TryAsPeerConn() (*PeerConn, bool) {
func (pc *PeerConn) isLowOnRequests() bool {
return pc.actualRequestState.Requests.IsEmpty()
}
func (pc *PeerConn) remoteIsTransmission() bool {
return bytes.HasPrefix(pc.PeerID[:], []byte("-TR")) && pc.PeerID[7] == '-'
}