From 81b4416a6fa44f783b5e9edfd05b1ccbb36bdf45 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 6 Jan 2014 13:04:26 +0000 Subject: [PATCH] only fire message for starting the server if the server is not running at the moment --- src/socket.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/socket.cpp b/src/socket.cpp index 5f6c353e..4612d3b4 100755 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -187,19 +187,13 @@ void CSocket::OnDataReceived() if ( pServer->PutData ( vecbyRecBuf, iNumBytesRead, RecHostAddr ) ) { - - -// TODO: we should only post the event in case the server is turned off for -// speed optimization and avoiding possible locks -//if ( !pServer->IsRunning() ) -//{ - - - // this was an audio packet, start server - // tell the server object to wake up if it - // is in sleep mode (Qt will delete the event object when done) - QCoreApplication::postEvent ( pServer, - new CCustomEvent ( MS_PACKET_RECEIVED, 0, 0 ) ); + // this was an audio packet, start server if it is in sleep mode + if ( !pServer->IsRunning() ) + { + // (note that Qt will delete the event object when done) + QCoreApplication::postEvent ( pServer, + new CCustomEvent ( MS_PACKET_RECEIVED, 0, 0 ) ); + } } } }