mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:58:51 +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 getAverageKilobitsPerSecond();
|
||||||
float getAveragePacketsPerSecond();
|
float getAveragePacketsPerSecond();
|
||||||
|
|
||||||
long long getPingTime() { return _pingTime; };
|
int getPingTime() { return _pingMs; };
|
||||||
void setPingTime(long long pingTime) { _pingTime = pingTime; };
|
void setPingTime(int pingMs) { _pingMs = pingMs; };
|
||||||
|
|
||||||
static void printLog(Agent const&);
|
static void printLog(Agent const&);
|
||||||
private:
|
private:
|
||||||
|
@ -82,7 +82,7 @@ private:
|
||||||
SimpleMovingAverage* _bytesReceivedMovingAverage;
|
SimpleMovingAverage* _bytesReceivedMovingAverage;
|
||||||
AgentData* _linkedData;
|
AgentData* _linkedData;
|
||||||
bool _isAlive;
|
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++) {
|
for(AgentList::iterator agent = begin(); agent != end(); agent++) {
|
||||||
if (socketMatch(agent->getPublicSocket(), agentAddress) ||
|
if (socketMatch(agent->getPublicSocket(), agentAddress) ||
|
||||||
socketMatch(agent->getLocalSocket(), agentAddress)) {
|
socketMatch(agent->getLocalSocket(), agentAddress)) {
|
||||||
long long pingTime = usecTimestampNow() - *(long long *)(pingPacket+1);
|
int pingTime = usecTimestampNow() - *(long long *)(pingPacket+1);
|
||||||
agent->setPingTime(pingTime);
|
agent->setPingTime(pingTime / 1000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,15 +98,13 @@ void AgentList::processAgentData(sockaddr *senderAddress, unsigned char *packetD
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PACKET_HEADER_PING: {
|
case PACKET_HEADER_PING: {
|
||||||
// _agentSocket.send(senderAddress, &PACKET_HEADER_PING_REPLY, 1);
|
char pingPacket[dataBytes];
|
||||||
char pingPacket[1 + sizeof(long long)];
|
memcpy(pingPacket, packetData, dataBytes);
|
||||||
memcpy(pingPacket, packetData, 1 + sizeof(long long));
|
|
||||||
pingPacket[0] = PACKET_HEADER_PING_REPLY;
|
pingPacket[0] = PACKET_HEADER_PING_REPLY;
|
||||||
_agentSocket.send(senderAddress, pingPacket, 1 + sizeof(long long));
|
_agentSocket.send(senderAddress, pingPacket, dataBytes);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PACKET_HEADER_PING_REPLY: {
|
case PACKET_HEADER_PING_REPLY: {
|
||||||
// handlePingReply(senderAddress);
|
|
||||||
timePingReply(senderAddress, packetData);
|
timePingReply(senderAddress, packetData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ public:
|
||||||
AgentListIterator end() const;
|
AgentListIterator end() const;
|
||||||
|
|
||||||
char getOwnerType() const { return _ownerType; }
|
char getOwnerType() const { return _ownerType; }
|
||||||
char *getAgentTypesOfInterest() const { return _agentTypesOfInterest; }
|
|
||||||
|
|
||||||
uint16_t getLastAgentID() const { return _lastAgentID; }
|
uint16_t getLastAgentID() const { return _lastAgentID; }
|
||||||
void increaseAgentID() { ++_lastAgentID; }
|
void increaseAgentID() { ++_lastAgentID; }
|
||||||
|
|
Loading…
Reference in a new issue