From 51269f4b91151306202a1414c3117daad8736f65 Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Tue, 22 Mar 2011 20:57:59 +0100 Subject: [PATCH] don't flush empty buffers --- servatrice/src/serversocketinterface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/servatrice/src/serversocketinterface.cpp b/servatrice/src/serversocketinterface.cpp index ff91c99c..9b2e2160 100644 --- a/servatrice/src/serversocketinterface.cpp +++ b/servatrice/src/serversocketinterface.cpp @@ -58,11 +58,9 @@ ServerSocketInterface::ServerSocketInterface(Servatrice *_server, QTcpSocket *_s ServerSocketInterface::~ServerSocketInterface() { - QMutexLocker locker(&protocolHandlerMutex); - logger->logMessage("ServerSocketInterface destructor"); - socket->flush(); + flushXmlBuffer(); delete xmlWriter; delete xmlReader; delete socket; @@ -80,6 +78,8 @@ void ServerSocketInterface::processProtocolItem(ProtocolItem *item) void ServerSocketInterface::flushXmlBuffer() { QMutexLocker locker(&xmlBufferMutex); + if (xmlBuffer.isEmpty()) + return; socket->write(xmlBuffer.toUtf8()); socket->flush(); xmlBuffer.clear();