Skip to content

Commit

Permalink
Merge pull request #1380 from davidBar-On/issue-1367-do-not-count-UDP…
Browse files Browse the repository at this point in the history
…-messages-that-were-not-sent

Do not count UDP messages that were not sent.

Fixes #1367
  • Loading branch information
bmah888 authored Jul 21, 2023
2 parents 40a663b + 21c315d commit bd50531
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/iperf_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,15 @@ iperf_udp_send(struct iperf_stream *sp)

r = Nwrite(sp->socket, sp->buffer, size, Pudp);

if (r < 0)
return r;
if (r <= 0) {
--sp->packet_count; /* Don't count messages that no data was sent from them.
* Allows "resending" a massage with the same numbering */
if (r < 0) {
if (r == NET_SOFTERROR && sp->test->debug_level >= DEBUG_LEVEL_INFO)
printf("UDP send failed on NET_SOFTERROR. errno=%s\n", strerror(errno));
return r;
}
}

sp->result->bytes_sent += r;
sp->result->bytes_sent_this_interval += r;
Expand Down

0 comments on commit bd50531

Please sign in to comment.