mirror of https://github.com/aria2/aria2
Fix bug that causes bogus EOF connection failure in BitTorrent downloads
parent
41df1607f6
commit
ae11b7a85d
|
@ -124,7 +124,7 @@ bool PeerConnection::receiveMessage(unsigned char* data, size_t& dataLength)
|
|||
}
|
||||
break;
|
||||
case (BT_MSG_READ_PAYLOAD):
|
||||
// We chosen the bufferCapacity_ so that whole message,
|
||||
// We chose the bufferCapacity_ so that whole message,
|
||||
// including 4 bytes length and payload, in it. So here we
|
||||
// just make sure that it happens.
|
||||
if (resbufLength_ - msgOffset_ >= 4 + currentPayloadLength_) {
|
||||
|
@ -150,7 +150,7 @@ bool PeerConnection::receiveMessage(unsigned char* data, size_t& dataLength)
|
|||
else {
|
||||
assert(resbufOffset_ == resbufLength_);
|
||||
if (resbufLength_ != 0) {
|
||||
if (msgOffset_ == 0 && resbufLength_ == currentPayloadLength_ + 4) {
|
||||
if (resbufLength_ - msgOffset_ == currentPayloadLength_ + 4) {
|
||||
// All bytes in buffer have been processed, so clear it
|
||||
// away.
|
||||
resbufLength_ = 0;
|
||||
|
|
Loading…
Reference in New Issue