hlswmaster-ng/gamescanner.cpp

36 lines
644 B
C++
Raw Normal View History

2006-02-02 16:55:44 +01:00
#include "logging.h"
2006-02-19 18:45:56 +01:00
#include "netpkt.h"
2006-02-02 16:55:44 +01:00
#include "gamescanner.h"
2006-02-20 21:58:59 +01:00
#define DEFAULT_SCAN_INTERVAL 30
2006-02-02 16:55:44 +01:00
2006-02-20 12:31:34 +01:00
GameScanner::GameScanner(Config& conf, ModuleList& modList, RecvQueue& rxQueue)
2006-02-19 18:45:56 +01:00
: modList(modList), rxQueue(rxQueue)
2006-02-02 16:55:44 +01:00
{
msock = new MultiSock(conf);
2006-03-05 02:28:19 +01:00
2006-02-20 21:58:59 +01:00
int interval = conf.getInteger("global", "scan_interval", DEFAULT_SCAN_INTERVAL);
TimerService::registerTimer(new Timer(new ScanEvent(*this), interval));
2006-02-02 16:55:44 +01:00
}
GameScanner::~GameScanner()
{
delete msock;
}
int GameScanner::execute(void* arg)
{
while (1) {
2006-03-05 02:28:19 +01:00
NetPkt* pkt = msock->recv();
if (pkt)
rxQueue.addPkt(pkt);
2006-02-02 16:55:44 +01:00
}
return 0;
}
void GameScanner::scan()
{
modList.scan(msock);
}