Merge pull request #8796 from sepalani/so-econn
Socket: Fix ENOTCONN error code
This commit is contained in:
commit
ebd08c82db
|
@ -51,7 +51,12 @@ char* WiiSockMan::DecodeError(s32 ErrorCode)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32 TranslateErrorCode(s32 native_error, bool isRW)
|
// The following functions can return
|
||||||
|
// - EAGAIN / EWOULDBLOCK: send(to), recv(from), accept
|
||||||
|
// - EINPROGRESS: connect, bind
|
||||||
|
// - WSAEWOULDBLOCK: send(to), recv(from), accept, connect
|
||||||
|
// On Windows is_rw is used to correct the return value for connect
|
||||||
|
static s32 TranslateErrorCode(s32 native_error, bool is_rw)
|
||||||
{
|
{
|
||||||
switch (native_error)
|
switch (native_error)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +72,7 @@ static s32 TranslateErrorCode(s32 native_error, bool isRW)
|
||||||
case ERRORCODE(EISCONN):
|
case ERRORCODE(EISCONN):
|
||||||
return -SO_EISCONN;
|
return -SO_EISCONN;
|
||||||
case ERRORCODE(ENOTCONN):
|
case ERRORCODE(ENOTCONN):
|
||||||
return -SO_EAGAIN; // After proper blocking SO_EAGAIN shouldn't be needed...
|
return -SO_ENOTCONN;
|
||||||
case ERRORCODE(EINPROGRESS):
|
case ERRORCODE(EINPROGRESS):
|
||||||
return -SO_EINPROGRESS;
|
return -SO_EINPROGRESS;
|
||||||
case ERRORCODE(EALREADY):
|
case ERRORCODE(EALREADY):
|
||||||
|
@ -86,14 +91,7 @@ static s32 TranslateErrorCode(s32 native_error, bool isRW)
|
||||||
case ERRORCODE(ENETRESET):
|
case ERRORCODE(ENETRESET):
|
||||||
return -SO_ENETRESET;
|
return -SO_ENETRESET;
|
||||||
case EITHER(WSAEWOULDBLOCK, EAGAIN):
|
case EITHER(WSAEWOULDBLOCK, EAGAIN):
|
||||||
if (isRW)
|
return (is_rw) ? (-SO_EAGAIN) : (-SO_EINPROGRESS);
|
||||||
{
|
|
||||||
return -SO_EAGAIN; // EAGAIN
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return -SO_EINPROGRESS; // EINPROGRESS
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue