Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transmission doesn't ack Cancel with RejectRequest #511

Closed
jech opened this issue Feb 10, 2018 · 3 comments · Fixed by #2275
Closed

Transmission doesn't ack Cancel with RejectRequest #511

jech opened this issue Feb 10, 2018 · 3 comments · Fixed by #2275

Comments

@jech
Copy link
Contributor

jech commented Feb 10, 2018

When a peer successfully negotiates the Fast request, it should acknowledge every Cancel with a RejectRequest — a Cancel gets exactly one reply, either Piece or RejectRequest.

It would appear that Transmission dosn't do that, which causes other clients to timeout waiting for the acknowledgement.

@anacrolix
Copy link
Contributor

I can confirm, this breaks other clients that are waiting for their cancels to be rejected. This is very surprising behaviour, and I've only encountered it because I'm now relying on the correct behaviour. The fix would go here:

case BtCancel:
{
struct peer_request r;
tr_peerIoReadUint32(msgs->io, inbuf, &r.index);
tr_peerIoReadUint32(msgs->io, inbuf, &r.offset);
tr_peerIoReadUint32(msgs->io, inbuf, &r.length);
msgs->cancelsSentToClient.add(tr_time(), 1);
dbgmsg(msgs, "got a Cancel %u:%u->%u", r.index, r.offset, r.length);
for (int i = 0; i < msgs->pendingReqsToClient; ++i)
{
struct peer_request const* req = msgs->peerAskedFor + i;
if (req->index == r.index && req->offset == r.offset && req->length == r.length)
{
tr_removeElementFromArray(msgs->peerAskedFor, i, sizeof(struct peer_request), msgs->pendingReqsToClient);
--msgs->pendingReqsToClient;
break;
}
}
break;
}
.

@anacrolix
Copy link
Contributor

It needs something like:

else if (fext)
    {
        protocolSendReject(msgs, req);
    }

@anacrolix
Copy link
Contributor

Thanks @ckerr and @jech .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants