From 7503db3e19e00892c1cedeb1e6fa56fa556f7e7c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 11 Mar 2013 19:26:21 -0700 Subject: [PATCH] output time difference in receive of packets from client --- mixer/src/main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mixer/src/main.cpp b/mixer/src/main.cpp index 793119f6f6..7d9462fd49 100644 --- a/mixer/src/main.cpp +++ b/mixer/src/main.cpp @@ -63,14 +63,10 @@ void *sendBuffer(void *args) timeval startTime, lastSend; gettimeofday(&startTime, NULL); - gettimeofday(&lastSend, NULL); while (true) { sentBytes = 0; - printf("Last send was %f ms ago\n", (usecTimestampNow() - usecTimestamp(&lastSend)) / 1000); - gettimeofday(&lastSend, NULL); - for (int i = 0; i < agentList.getAgents().size(); i++) { AudioRingBuffer *agentBuffer = (AudioRingBuffer *) agentList.getAgents()[i].getLinkedData(); @@ -307,10 +303,16 @@ int main(int argc, const char * argv[]) } sockaddr *agentAddress = new sockaddr; + timeval lastReceive; + gettimeofday(&lastReceive, NULL); while (true) { if(agentList.getAgentSocket().receive(agentAddress, packetData, &receivedBytes)) { if (packetData[0] == 'I') { + + printf("Last receive was %f ms ago\n", (usecTimestampNow() - usecTimestamp(&lastReceive)) / 1000); + gettimeofday(&lastreceive, NULL); + // add or update the existing interface agent if (!LOOPBACK_SANITY_CHECK) { agentList.addOrUpdateAgent(agentAddress, agentAddress, packetData[0]);