mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-15 15:53:55 +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);
|
||||
if (winIPC->unshiftedBytes > 0)
|
||||
{
|
||||
winIPC->bufferOffset += (winIPC->bytesLeft - winIPC->unshiftedBytes);
|
||||
if (winIPC->bytesLeft == winIPC->unshiftedBytes)
|
||||
if (winIPC->unshiftedBytes == winIPC->bytesLeft)
|
||||
{
|
||||
// Unshift the entire buffer
|
||||
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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user