mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 23:26:25 +02:00
use new non-threaded method to checkin with domain server
This commit is contained in:
parent
1e05936aea
commit
8c30c3ff7f
1 changed files with 10 additions and 7 deletions
|
@ -702,7 +702,6 @@ int main(int argc, const char * argv[])
|
|||
|
||||
agentList->linkedDataCreateCallback = NULL; // do we need a callback?
|
||||
agentList->startSilentAgentRemovalThread();
|
||||
agentList->startDomainServerCheckInThread();
|
||||
|
||||
srand((unsigned)time(0));
|
||||
|
||||
|
@ -713,16 +712,20 @@ int main(int argc, const char * argv[])
|
|||
|
||||
unsigned char* packetData = new unsigned char[MAX_PACKET_SIZE];
|
||||
ssize_t receivedBytes;
|
||||
|
||||
timeval lastDomainServerCheckIn = {};
|
||||
|
||||
// loop to send to agents requesting data
|
||||
while (true) {
|
||||
// Agents sending messages to us...
|
||||
// send a check in packet to the domain server if DOMAIN_SERVER_CHECK_IN_USECS has elapsed
|
||||
if (usecTimestampNow() - usecTimestamp(&lastDomainServerCheckIn) >= DOMAIN_SERVER_CHECK_IN_USECS) {
|
||||
gettimeofday(&lastDomainServerCheckIn, NULL);
|
||||
AgentList::getInstance()->sendDomainServerCheckIn();
|
||||
}
|
||||
|
||||
// Agents sending messages to us...
|
||||
if (agentList->getAgentSocket()->receive(&agentPublicAddress, packetData, &receivedBytes)) {
|
||||
switch (packetData[0]) {
|
||||
default: {
|
||||
AgentList::getInstance()->processAgentData(&agentPublicAddress, packetData, receivedBytes);
|
||||
} break;
|
||||
}
|
||||
AgentList::getInstance()->processAgentData(&agentPublicAddress, packetData, receivedBytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue