mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-17 16:53:13 +00:00
Fixed unshift logic for IPC socket
This commit is contained in:
@@ -883,12 +883,21 @@ void ILibDuktape_net_server_IPC_ResumeSink(ILibDuktape_DuplexStream *sender, voi
|
|||||||
ILibDuktape_DuplexStream_WriteData(winIPC->ds, winIPC->buffer + winIPC->bufferOffset, winIPC->bytesLeft);
|
ILibDuktape_DuplexStream_WriteData(winIPC->ds, winIPC->buffer + winIPC->bufferOffset, winIPC->bytesLeft);
|
||||||
if (winIPC->unshiftedBytes > 0)
|
if (winIPC->unshiftedBytes > 0)
|
||||||
{
|
{
|
||||||
winIPC->bufferOffset += (winIPC->bytesLeft - winIPC->unshiftedBytes);
|
if (winIPC->unshiftedBytes == winIPC->bytesLeft)
|
||||||
if (winIPC->bytesLeft == winIPC->unshiftedBytes)
|
|
||||||
{
|
{
|
||||||
|
// Unshift the entire buffer
|
||||||
winIPC->unshiftedBytes = 0;
|
winIPC->unshiftedBytes = 0;
|
||||||
}
|
}
|
||||||
winIPC->bytesLeft = winIPC->unshiftedBytes;
|
else
|
||||||
|
{
|
||||||
|
// Unshift some of the buffer
|
||||||
|
winIPC->bufferOffset += (winIPC->bytesLeft - winIPC->unshiftedBytes);
|
||||||
|
if (winIPC->bytesLeft == winIPC->unshiftedBytes)
|
||||||
|
{
|
||||||
|
winIPC->unshiftedBytes = 0;
|
||||||
|
}
|
||||||
|
winIPC->bytesLeft = winIPC->unshiftedBytes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user