Skip to content

Commit eb8fa97

Browse files
committed
Do not consider a receive timeout to be an error
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 <jseldenthuis@lely.com>
1 parent 2bfdfd5 commit eb8fa97

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/c/profile/transport/ip/tcp/tcp_transport_posix_nopoll.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ size_t uxr_read_tcp_data_platform(
148148

149149
remaining_time = timeout - (int)(uxr_millis() - start_timestamp);
150150
} while (-1 == bytes_received && EINTR == errno);
151+
if (-1 == bytes_received && (EAGAIN == errno || EWOULDBLOCK == errno)) {
152+
errno = errsv;
153+
bytes_received = 0;
154+
}
151155
if (-1 != bytes_received)
152156
{
153157
rv = (size_t)bytes_received;

src/c/profile/transport/ip/udp/udp_transport_posix_nopoll.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ size_t uxr_read_udp_data_platform(
135135

136136
remaining_time = timeout - (int)(uxr_millis() - start_timestamp);
137137
} while (-1 == bytes_received && EINTR == errno);
138+
if (-1 == bytes_received && (EAGAIN == errno || EWOULDBLOCK == errno)) {
139+
errno = errsv;
140+
bytes_received = 0;
141+
}
138142
if (-1 != bytes_received)
139143
{
140144
rv = (size_t)bytes_received;

0 commit comments

Comments
 (0)