ping reporter added to interface take 2

This commit is contained in:
Mark Peng 2013-06-28 11:17:52 -07:00
parent c5fe8b078e
commit ee005f19d9
4 changed files with 2 additions and 5 deletions

View file

@ -93,7 +93,6 @@ int main(int argc, const char* argv[]) {
} }
if (agentList->getAgentSocket()->receive(agentAddress, packetData, &receivedBytes)) { if (agentList->getAgentSocket()->receive(agentAddress, packetData, &receivedBytes)) {
switch (packetData[0]) { switch (packetData[0]) {
case PACKET_HEADER_HEAD_DATA: case PACKET_HEADER_HEAD_DATA:
// grab the agent ID from the packet // grab the agent ID from the packet

View file

@ -161,8 +161,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
_packetCount(0), _packetCount(0),
_packetsPerSecond(0), _packetsPerSecond(0),
_bytesPerSecond(0), _bytesPerSecond(0),
_bytesCount(0), _bytesCount(0)
_pingSentTime(0)
{ {
_applicationStartupTime = startup_time; _applicationStartupTime = startup_time;
_window->setWindowTitle("Interface"); _window->setWindowTitle("Interface");
@ -774,7 +773,6 @@ void sendPingPacket() {
// Every second, check the frame rates and other stuff // Every second, check the frame rates and other stuff
void Application::timer() { void Application::timer() {
gettimeofday(&_timerEnd, NULL); gettimeofday(&_timerEnd, NULL);
_pingSentTime = usecTimestampNow();
sendPingPacket(); sendPingPacket();
_fps = (float)_frameCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f); _fps = (float)_frameCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);

View file

@ -222,7 +222,6 @@ private:
timeval _applicationStartupTime; timeval _applicationStartupTime;
timeval _timerStart, _timerEnd; timeval _timerStart, _timerEnd;
timeval _lastTimeIdle; timeval _lastTimeIdle;
long long _pingSentTime;
bool _justStarted; bool _justStarted;
Stars _stars; Stars _stars;

View file

@ -98,6 +98,7 @@ 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[1 + sizeof(long long)]; char pingPacket[1 + sizeof(long long)];
memcpy(pingPacket, packetData, 1 + sizeof(long long)); memcpy(pingPacket, packetData, 1 + sizeof(long long));
pingPacket[0] = PACKET_HEADER_PING_REPLY; pingPacket[0] = PACKET_HEADER_PING_REPLY;