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 20, 2022
1 parent f981362 commit b6c22e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/iperf_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,11 @@ 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->result->bytes_sent += r;
sp->result->bytes_sent_this_interval += r;
Expand Down
8 changes: 5 additions & 3 deletions src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,14 @@ Nwrite(int fd, const char *buf, size_t count, int prot)
#if (EAGAIN != EWOULDBLOCK)
case EWOULDBLOCK:
#endif
if (count == nleft)
return NET_SOFTERROR;
return count - nleft;

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 b6c22e6

Please sign in to comment.