diff --git a/domain-server/src/main.cpp b/domain-server/src/main.cpp index 1148f31c6a..0ca8e47905 100644 --- a/domain-server/src/main.cpp +++ b/domain-server/src/main.cpp @@ -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); + } } }