Fix getSendBuffer reordering bug
This commit is contained in:
+15
-2
@@ -128,9 +128,22 @@ protected:
|
|||||||
return {sendBuffer, SendBufferAttribute::NEEDS_UNCORK};
|
return {sendBuffer, SendBufferAttribute::NEEDS_UNCORK};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
/* If we are corked and there is already data in the cork buffer,
|
||||||
|
mark how much is ours and reset it */
|
||||||
|
unsigned int ourCorkOffset = 0;
|
||||||
|
if (isCorked() && loopData->corkOffset) {
|
||||||
|
ourCorkOffset = loopData->corkOffset;
|
||||||
|
loopData->corkOffset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Fallback is to use the backpressure as buffer */
|
/* Fallback is to use the backpressure as buffer */
|
||||||
backPressure.resize(existingBackpressure + size);
|
backPressure.resize(ourCorkOffset + existingBackpressure + size);
|
||||||
return {(char *) backPressure.data() + existingBackpressure, SendBufferAttribute::NEEDS_DRAIN};
|
|
||||||
|
/* And copy corkbuffer in front */
|
||||||
|
memcpy((char *) backPressure.data() + existingBackpressure, loopData->corkBuffer, ourCorkOffset);
|
||||||
|
|
||||||
|
return {(char *) backPressure.data() + ourCorkOffset + existingBackpressure, SendBufferAttribute::NEEDS_DRAIN};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user