handle first packet stats better

This commit is contained in:
ZappoMan 2014-08-01 13:15:57 -07:00
parent 8359ebb82f
commit 8c14f948f2

View file

@ -123,11 +123,15 @@ void runReceive(const char* addressOption, int port, int gap, int size) {
return;
}
quint64 last = usecTimestampNow();
quint64 last = 0; // first case
while (true) {
n = recvfrom(sockfd, inputBuffer, size, 0, NULL, NULL); // we don't care about where it came from
if (last == 0) {
last = usecTimestampNow();
std::cout << "first packet received\n";
} else {
quint64 now = usecTimestampNow();
int actualGap = now - last;
timeGaps.update(actualGap);
@ -142,4 +146,5 @@ void runReceive(const char* addressOption, int port, int gap, int size) {
last = now;
}
}
}