Skip to content

Commit

Permalink
Do not consider a receive timeout to be an error
Browse files Browse the repository at this point in the history
The non-polling versions of the POSIX transport profiles shoud behave the same
as the polling versions. That means that a receive timeout, because no data was
available, is not an error.

Signed-off-by: J. S. Seldenthuis <[email protected]>
  • Loading branch information
jseldent committed Jun 21, 2022
1 parent 705369b commit c66ca5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/c/profile/transport/ip/tcp/tcp_transport_posix_nopoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ size_t uxr_read_tcp_data_platform(

remaining_time = timeout - (int)(uxr_millis() - start_timestamp);
} while (-1 == bytes_received && EINTR == errno);
if (-1 == bytes_received && (EAGAIN == errno || EWOULDBLOCK == errno)) {
errno = errsv;
bytes_received = 0;
}
if (-1 != bytes_received)
{
rv = (size_t)bytes_received;
Expand Down
4 changes: 4 additions & 0 deletions src/c/profile/transport/ip/udp/udp_transport_posix_nopoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ size_t uxr_read_udp_data_platform(

remaining_time = timeout - (int)(uxr_millis() - start_timestamp);
} while (-1 == bytes_received && EINTR == errno);
if (-1 == bytes_received && (EAGAIN == errno || EWOULDBLOCK == errno)) {
errno = errsv;
bytes_received = 0;
}
if (-1 != bytes_received)
{
rv = (size_t)bytes_received;
Expand Down

0 comments on commit c66ca5b

Please sign in to comment.