From 252c302ccf6c798fa23c06d70a3bbf3e03b5c286 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Thu, 17 Sep 2009 19:48:00 +0000 Subject: [PATCH] enable delay to somehow improve the disconnect behaviour (problem not yet fully solved) --- src/client.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 9688b3db..559c6b6a 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -334,13 +334,15 @@ void CClient::Stop() // stop audio interface Sound.Stop(); -/* -// TEST (seems not to work, disconnect is still not working reliably) -QTime dieTime = QTime::currentTime().addMSecs(500); -while( QTime::currentTime() < dieTime ) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); -} -*/ + // wait for approx. 300 ms to make sure no audio packet is still in the + // network queue causing the channel to be reconnected right after having + // received the disconnect message (seems not to gain much, disconnect is + // still not working reliably) + QTime dieTime = QTime::currentTime().addMSecs ( 300 ); + while ( QTime::currentTime() < dieTime ) + { + QCoreApplication::processEvents ( QEventLoop::AllEvents, 100 ); + } // Send disconnect message to server (Since we disable our protocol // receive mechanism with the next command, we do not evaluate any