mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-02-16 02:21:07 +00:00
Check for both EWOULDBLOCK and EAGAIN for OSes where those values differ
This commit is contained in:
@@ -87,7 +87,9 @@ int recvUdpSocket(SOCKET s, char* buffer, int size, int useSelect) {
|
||||
// socket via SO_RCVTIMEO, so we can avoid a syscall
|
||||
// for each packet.
|
||||
err = (int)recv(s, buffer, size, 0);
|
||||
if (err < 0 && LastSocketError() == EWOULDBLOCK) {
|
||||
if (err < 0 &&
|
||||
(LastSocketError() == EWOULDBLOCK ||
|
||||
LastSocketError() == EAGAIN)) {
|
||||
// Return 0 for timeout
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#define SHUT_RDWR SD_BOTH
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define EAGAIN WSAEWOULDBLOCK
|
||||
|
||||
typedef int SOCK_RET;
|
||||
typedef int SOCKADDR_LEN;
|
||||
|
||||
Reference in New Issue
Block a user