smarter wake microstamp update for solo agents in DS

This commit is contained in:
Stephen Birarda 2013-05-06 14:46:01 -07:00
parent c793f3385c
commit cfd4a4a44a

View file

@ -119,11 +119,6 @@ int main(int argc, const char * argv[])
agentType,
agentList->getLastAgentId())) {
agentList->increaseAgentId();
} else if (packetData[0] == PACKET_HEADER_DOMAIN_RFD) {
// if this is a previous agent, and they are re-reporting for duty
// then we need to update the first receive time
Agent* refreshedAgent = agentList->agentWithAddress((sockaddr*) &agentLocalAddress);
refreshedAgent->setWakeMicrostamp(usecTimestampNow());
}
currentBufferPos = broadcastPacket + 1;
@ -147,8 +142,14 @@ int main(int argc, const char * argv[])
}
}
} else {
double timeNow = usecTimestampNow();
// this is the agent, just update last receive to now
agent->setLastHeardMicrostamp(usecTimestampNow());
agent->setLastHeardMicrostamp(timeNow);
if (packetData[0] == PACKET_HEADER_DOMAIN_RFD
&& memchr(SOLO_AGENT_TYPES, agentType, sizeof(SOLO_AGENT_TYPES))) {
agent->setWakeMicrostamp(timeNow);
}
}
}