mirror of
https://github.com/dlang-community/DCD.git
synced 2025-04-27 21:59:55 +03:00
make sure large requests are properly sent
This commit is contained in:
parent
758c78145f
commit
cc8f088eef
1 changed files with 9 additions and 1 deletions
|
@ -205,7 +205,15 @@ bool sendRequest(Socket socket, AutocompleteRequest request)
|
|||
auto messageLength = message.length;
|
||||
messageBuffer[0 .. size_t.sizeof] = (cast(ubyte*) &messageLength)[0 .. size_t.sizeof];
|
||||
messageBuffer[size_t.sizeof .. $] = message[];
|
||||
return socket.send(messageBuffer) == messageBuffer.length;
|
||||
size_t i;
|
||||
while (i < messageBuffer.length)
|
||||
{
|
||||
auto sent = socket.send(messageBuffer[i .. $]);
|
||||
if (sent == Socket.ERROR)
|
||||
return false;
|
||||
i += sent;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue