From 3615d9e0b7a47128875af0952e019dc4f0045cf2 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sat, 18 Feb 2006 12:08:56 +0000 Subject: [PATCH] wake server if packet is received --- configure.in | 2 +- src/server.cpp | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/configure.in b/configure.in index 8aac9025..44f2dc79 100755 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) AC_INIT(src/main.cpp) -AM_INIT_AUTOMAKE(llcon,0.9.2cvs) +AM_INIT_AUTOMAKE(llcon,0.9.3cvs) AM_CONFIG_HEADER(config.h) diff --git a/src/server.cpp b/src/server.cpp index 570af8b7..e40ada22 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -47,6 +47,8 @@ void CServer::Start () /* init time for response time evaluation */ TimeLastBlock = QTime::currentTime (); + +qDebug("Server started"); } } @@ -98,13 +100,11 @@ void CServer::OnTimer () } else { - /* disable server */ - -// TODO not yet working since the socket does not have access to the server -// object and cannot restart the server if packets arrive... - -// Stop (); + // Disable server if no clients are connected. In this case the server + // does not consume any significant CPU when no client is connected. + Stop (); +qDebug("Server stopped"); } } @@ -165,9 +165,10 @@ void CServer::customEvent(QCustomEvent* Event) switch(iMessType) { case MS_PACKET_RECEIVED: - -printf("packet received\n"); - + // wake up the server if a packet was received + // if the server is still running, the call to Start() will have + // no effect + Start (); break; } }