SCP/TMXR: Fix to socket writes to return 0 bytes written as an expected condition when the output socket is full (EAGAIN or EWOULDBLOCK).
This commit is contained in:
parent
796cbd2796
commit
43f85d1f3a
1 changed files with 12 additions and 1 deletions
13
sim_sock.c
13
sim_sock.c
|
@ -1033,7 +1033,18 @@ return rbytes;
|
|||
|
||||
int32 sim_write_sock (SOCKET sock, char *msg, int32 nbytes)
|
||||
{
|
||||
return send (sock, msg, nbytes, 0);
|
||||
int32 err, sbytes = send (sock, msg, nbytes, 0);
|
||||
|
||||
if (sbytes == SOCKET_ERROR) {
|
||||
err = WSAGetLastError ();
|
||||
if (err == WSAEWOULDBLOCK) /* no data */
|
||||
return 0;
|
||||
#if defined(EAGAIN)
|
||||
if (err == EAGAIN) /* no data */
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
return sbytes;
|
||||
}
|
||||
|
||||
void sim_close_sock (SOCKET sock, t_bool master)
|
||||
|
|
Loading…
Add table
Reference in a new issue