--- smsdaemon/SmsDaemon.cpp 2008/06/16 11:57:48 94 +++ smsdaemon/SmsDaemon.cpp 2008/12/06 14:25:53 126 @@ -19,7 +19,6 @@ using namespace std; - void SmsDaemon::CreateLogMessage(SMS& sms,bool hasPlugin) { ostringstream os; @@ -33,6 +32,14 @@ void SmsDaemon::CheckSms() { + const int INTERVAL = 250; //no of milliseconds between sms checks + timeval now = Util::GetTimeOfDay(); + + if ( Util::mTimeDiff(_lastSmsCheck,now) < INTERVAL) + return; + + _lastSmsCheck = now; + Common* cmn = Common::instance(); PluginManager* manager = cmn->GetPluginManager(); @@ -71,16 +78,22 @@ mainContinue = true; + int loopcount = 0; while (mainContinue) { + if (loopcount > 100 ) + { + CheckSms(); - CheckSms(); + cmn->GetTaskManager()->ExecuteTasks(_modem); - cmn->GetTaskManager()->ExecuteTasks(_modem); + loopcount = 0; + } if (cmn->isDebug && kbhit()) break; + loopcount++; Util::Sleep(10); } @@ -92,10 +105,11 @@ cmn->daemonStart = time(0); + _lastSmsCheck = Util::GetTimeOfDay(); cmn->logMessage("--------------------------------"); cmn->logMessage( VERSION ); - cmn->logMessage( SVNVER ); + cmn->logMessage( SVNVERSION ); cmn->GetTaskManager()->LoadTasks(); cmn->GetPluginManager()->LoadPlugins();