mirror of
https://github.com/overte-org/overte.git
synced 2025-04-10 19:29:07 +02:00
ping reporter added to interface take 4
This commit is contained in:
parent
293031de6f
commit
a5dc47eaab
6 changed files with 8 additions and 102775 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -63,8 +63,8 @@ public:
|
|||
float getAverageKilobitsPerSecond();
|
||||
float getAveragePacketsPerSecond();
|
||||
|
||||
long long getPingTime() { return _pingTime; };
|
||||
void setPingTime(long long pingTime) { _pingTime = pingTime; };
|
||||
int getPingTime() { return _pingMs; };
|
||||
void setPingTime(int pingMs) { _pingMs = pingMs; };
|
||||
|
||||
static void printLog(Agent const&);
|
||||
private:
|
||||
|
@ -82,7 +82,7 @@ private:
|
|||
SimpleMovingAverage* _bytesReceivedMovingAverage;
|
||||
AgentData* _linkedData;
|
||||
bool _isAlive;
|
||||
long long _pingTime;
|
||||
int _pingMs;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -84,8 +84,8 @@ void AgentList::timePingReply(sockaddr *agentAddress, unsigned char *packetData)
|
|||
for(AgentList::iterator agent = begin(); agent != end(); agent++) {
|
||||
if (socketMatch(agent->getPublicSocket(), agentAddress) ||
|
||||
socketMatch(agent->getLocalSocket(), agentAddress)) {
|
||||
long long pingTime = usecTimestampNow() - *(long long *)(pingPacket+1);
|
||||
agent->setPingTime(pingTime);
|
||||
int pingTime = usecTimestampNow() - *(long long *)(pingPacket+1);
|
||||
agent->setPingTime(pingTime / 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -98,15 +98,13 @@ void AgentList::processAgentData(sockaddr *senderAddress, unsigned char *packetD
|
|||
break;
|
||||
}
|
||||
case PACKET_HEADER_PING: {
|
||||
// _agentSocket.send(senderAddress, &PACKET_HEADER_PING_REPLY, 1);
|
||||
char pingPacket[1 + sizeof(long long)];
|
||||
memcpy(pingPacket, packetData, 1 + sizeof(long long));
|
||||
char pingPacket[dataBytes];
|
||||
memcpy(pingPacket, packetData, dataBytes);
|
||||
pingPacket[0] = PACKET_HEADER_PING_REPLY;
|
||||
_agentSocket.send(senderAddress, pingPacket, 1 + sizeof(long long));
|
||||
_agentSocket.send(senderAddress, pingPacket, dataBytes);
|
||||
break;
|
||||
}
|
||||
case PACKET_HEADER_PING_REPLY: {
|
||||
// handlePingReply(senderAddress);
|
||||
timePingReply(senderAddress, packetData);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ public:
|
|||
AgentListIterator end() const;
|
||||
|
||||
char getOwnerType() const { return _ownerType; }
|
||||
char *getAgentTypesOfInterest() const { return _agentTypesOfInterest; }
|
||||
|
||||
uint16_t getLastAgentID() const { return _lastAgentID; }
|
||||
void increaseAgentID() { ++_lastAgentID; }
|
||||
|
|
Loading…
Reference in a new issue