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