output time difference in receive of packets from client

This commit is contained in:
Stephen Birarda 2013-03-11 19:26:21 -07:00
parent 83952e7e32
commit 7503db3e19

View file

@ -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]);