Commit 8d596619 authored by Max-Wilhelm Bruker's avatar Max-Wilhelm Bruker
Browse files

server deadlock fix

parent 14287e54
......@@ -189,7 +189,8 @@ void ServerSocketInterface::flushOutputQueue()
int totalBytes = 0;
while (!outputQueue.isEmpty()) {
const ServerMessage &item = outputQueue.first();
ServerMessage item = outputQueue.takeFirst();
locker.unlock();
QByteArray buf;
unsigned int size = item.ByteSize();
......@@ -199,10 +200,11 @@ void ServerSocketInterface::flushOutputQueue()
buf.data()[2] = (unsigned char) (size >> 8);
buf.data()[1] = (unsigned char) (size >> 16);
buf.data()[0] = (unsigned char) (size >> 24);
// In case socket->write() calls catchSocketError(), the mutex must not be locked during this call.
socket->write(buf);
totalBytes += size + 4;
outputQueue.removeFirst();
locker.relock();
}
servatrice->incTxBytes(totalBytes);
socket->flush();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment