Skip to content

Commit

Permalink
NET_SOFTERROR on UDP send EAGAIN/EINTR errno if no data was sent
Browse files Browse the repository at this point in the history
  • Loading branch information
davidBar-On committed Aug 19, 2022
1 parent f981362 commit 6a62b42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions src/iperf_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ iperf_udp_send(struct iperf_stream *sp)

iperf_time_now(&before);

++sp->packet_count;

if (sp->test->udp_counters_64bit) {

uint32_t sec, usec;
Expand Down Expand Up @@ -250,8 +248,13 @@ iperf_udp_send(struct iperf_stream *sp)

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

if (r < 0)
return r;
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->packet_count;

sp->result->bytes_sent += r;
sp->result->bytes_sent_this_interval += r;
Expand Down
11 changes: 7 additions & 4 deletions src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,15 @@ Nwrite(int fd, const char *buf, size_t count, int prot)
#if (EAGAIN != EWOULDBLOCK)
case EWOULDBLOCK:
#endif
return count - nleft;
if (count > nleft)
return count - nleft;
else
return NET_SOFTERROR;

case ENOBUFS:
return NET_SOFTERROR;
case ENOBUFS :
return NET_SOFTERROR;

default:
default:
return NET_HARDERROR;
}
} else if (r == 0)
Expand Down

0 comments on commit 6a62b42

Please sign in to comment.