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 Aug 23, 2022
1 parent 2bfdfd5 commit eb8fa97
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 @@ -148,6 +148,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 @@ -135,6 +135,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 eb8fa97

Please sign in to comment.