wake server if packet is received

This commit is contained in:
Volker Fischer 2006-02-18 12:08:56 +00:00
parent f981fd466a
commit 3615d9e0b7
2 changed files with 11 additions and 10 deletions

View File

@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50) AC_PREREQ(2.50)
AC_INIT(src/main.cpp) AC_INIT(src/main.cpp)
AM_INIT_AUTOMAKE(llcon,0.9.2cvs) AM_INIT_AUTOMAKE(llcon,0.9.3cvs)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)

View File

@ -47,6 +47,8 @@ void CServer::Start ()
/* init time for response time evaluation */ /* init time for response time evaluation */
TimeLastBlock = QTime::currentTime (); TimeLastBlock = QTime::currentTime ();
qDebug("Server started");
} }
} }
@ -98,13 +100,11 @@ void CServer::OnTimer ()
} }
else else
{ {
/* disable server */ // Disable server if no clients are connected. In this case the server
// does not consume any significant CPU when no client is connected.
// TODO not yet working since the socket does not have access to the server Stop ();
// object and cannot restart the server if packets arrive...
// Stop ();
qDebug("Server stopped");
} }
} }
@ -165,9 +165,10 @@ void CServer::customEvent(QCustomEvent* Event)
switch(iMessType) switch(iMessType)
{ {
case MS_PACKET_RECEIVED: case MS_PACKET_RECEIVED:
// wake up the server if a packet was received
printf("packet received\n"); // if the server is still running, the call to Start() will have
// no effect
Start ();
break; break;
} }
} }