mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
[Client] Drain a single-instance payload before its handlers read the socket again
This commit is contained in:
parent
d8cc5522f2
commit
040be0c1d3
1 changed files with 6 additions and 3 deletions
|
|
@ -134,12 +134,15 @@ void SingleInstanceManager::handleNewConnection()
|
|||
socket->write(ACK_MESSAGE);
|
||||
socket->flush();
|
||||
|
||||
emit filesReceived(files);
|
||||
|
||||
// Reset buffer (single message use-case)
|
||||
// Drop the payload from the buffer before handling it: the handlers
|
||||
// run synchronously and can spin a nested event loop (e.g. a modal
|
||||
// dialog) that re-reads this socket, which would re-parse and re-emit
|
||||
// the same files.
|
||||
buffer->clear();
|
||||
*expectedSize = 0;
|
||||
|
||||
emit filesReceived(files);
|
||||
|
||||
socket->disconnectFromServer();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue