Skip to content

Commit c66ca5b

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 705369b commit c66ca5b

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
@@ -144,6 +144,10 @@ size_t uxr_read_tcp_data_platform(
144144

145145
remaining_time = timeout - (int)(uxr_millis() - start_timestamp);
146146
} while (-1 == bytes_received && EINTR == errno);
147+
if (-1 == bytes_received && (EAGAIN == errno || EWOULDBLOCK == errno)) {
148+
errno = errsv;
149+
bytes_received = 0;
150+
}
147151
if (-1 != bytes_received)
148152
{
149153
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
@@ -131,6 +131,10 @@ size_t uxr_read_udp_data_platform(
131131

132132
remaining_time = timeout - (int)(uxr_millis() - start_timestamp);
133133
} while (-1 == bytes_received && EINTR == errno);
134+
if (-1 == bytes_received && (EAGAIN == errno || EWOULDBLOCK == errno)) {
135+
errno = errsv;
136+
bytes_received = 0;
137+
}
134138
if (-1 != bytes_received)
135139
{
136140
rv = (size_t)bytes_received;

0 commit comments

Comments
 (0)