mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 22:40:27 +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->linkedDataCreateCallback = NULL; // do we need a callback?
|
||||||
agentList->startSilentAgentRemovalThread();
|
agentList->startSilentAgentRemovalThread();
|
||||||
agentList->startDomainServerCheckInThread();
|
|
||||||
|
|
||||||
srand((unsigned)time(0));
|
srand((unsigned)time(0));
|
||||||
|
|
||||||
|
@ -714,15 +713,19 @@ int main(int argc, const char * argv[])
|
||||||
unsigned char* packetData = new unsigned char[MAX_PACKET_SIZE];
|
unsigned char* packetData = new unsigned char[MAX_PACKET_SIZE];
|
||||||
ssize_t receivedBytes;
|
ssize_t receivedBytes;
|
||||||
|
|
||||||
|
timeval lastDomainServerCheckIn = {};
|
||||||
|
|
||||||
// loop to send to agents requesting data
|
// loop to send to agents requesting data
|
||||||
while (true) {
|
while (true) {
|
||||||
|
// 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...
|
// Agents sending messages to us...
|
||||||
if (agentList->getAgentSocket()->receive(&agentPublicAddress, packetData, &receivedBytes)) {
|
if (agentList->getAgentSocket()->receive(&agentPublicAddress, packetData, &receivedBytes)) {
|
||||||
switch (packetData[0]) {
|
AgentList::getInstance()->processAgentData(&agentPublicAddress, packetData, receivedBytes);
|
||||||
default: {
|
|
||||||
AgentList::getInstance()->processAgentData(&agentPublicAddress, packetData, receivedBytes);
|
|
||||||
} break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue