mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +00:00
ping: Don't wait before displaying closing statistics
Previously, we would wait for the ping interval after the last ping before displaying the closing statistics. We now display the closing statistics and exit as soon as the required number of pings has been performed.
This commit is contained in:
parent
834dc3747c
commit
e74324ad34
1 changed files with 4 additions and 5 deletions
|
@ -159,11 +159,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
struct timeval tv_send;
|
||||
gettimeofday(&tv_send, nullptr);
|
||||
|
||||
if (count.has_value() && total_pings == count.value())
|
||||
closing_statistics();
|
||||
else
|
||||
total_pings++;
|
||||
|
||||
TRY(Core::System::sendto(fd, ping_packet.data(), ping_packet.size(), 0, (const struct sockaddr*)&peer_address, sizeof(sockaddr_in)));
|
||||
|
||||
for (;;) {
|
||||
|
@ -239,6 +234,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
break;
|
||||
}
|
||||
|
||||
total_pings++;
|
||||
if (count.has_value() && total_pings == count.value())
|
||||
closing_statistics();
|
||||
|
||||
clock_nanosleep(CLOCK_MONOTONIC, 0, &interval_timespec, nullptr);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue