Skip to content

Commit

Permalink
In delay case expect to receive an emtpy initial packet.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluhm committed Jan 21, 2024
1 parent 15e92af commit 77f8dda
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions udpbench.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,14 @@ udp_receive(int udp_socket, int udp_family)
if ((payload = malloc(udplen + 1)) == NULL)
err(1, "malloc payload");

if (delay) {
/* before the delay expect an empty initial packet */
rcvlen = recv(udp_socket, payload, udplen + 1, 0);
if (rcvlen == -1)
err(1, "recv initial");
if (rcvlen > 0)
warnx("receive initial packet not empty %zd", rcvlen);
}
/* wait for the first packet to start timing */
rcvlen = recv(udp_socket, payload, udplen + 1, 0);
if (rcvlen == -1)
Expand Down

0 comments on commit 77f8dda

Please sign in to comment.