diff --git a/Userland/Utilities/ping.cpp b/Userland/Utilities/ping.cpp index f543094e0c..83b703e3bf 100644 --- a/Userland/Utilities/ping.cpp +++ b/Userland/Utilities/ping.cpp @@ -159,11 +159,6 @@ ErrorOr 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 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); } }