35 lines
611 B
C++
35 lines
611 B
C++
#include "logging.h"
|
|
#include "netpkt.h"
|
|
#include "gameparser.h"
|
|
|
|
GameParser::GameParser(RecvQueue& rxQueue, ModuleList& modList, GameList& gameList)
|
|
: rxQueue(rxQueue), modList(modList), gameList(gameList)
|
|
{
|
|
}
|
|
|
|
GameParser::~GameParser()
|
|
{
|
|
}
|
|
|
|
int GameParser::execute(void* arg)
|
|
{
|
|
while (1) {
|
|
NetPkt* pkt = rxQueue.getPkt();
|
|
int ret = modList.parse(pkt, &gameList);
|
|
|
|
switch (ret) {
|
|
case PKT_REJECT:
|
|
char buf[64];
|
|
pkt->show(buf, sizeof(buf));
|
|
LogSystem::log(LOG_NOTICE, "unknown Packet: %s", buf);
|
|
|
|
case PKT_ACCEPT:
|
|
delete pkt;
|
|
|
|
case PKT_ACCEPT_FREED:
|
|
break;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|