Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket: Fix ENOTCONN error code #8796

Merged
merged 1 commit into from Jun 19, 2020
Merged

Conversation

sepalani
Copy link
Contributor

@sepalani sepalani commented May 6, 2020

For some reason, Dolphin returns EAGAIN rather than ENOTCONN.

In some circumstances, it creates an infinite loop. For instance, using send with a socket which is not connected.

Is there any reason to keep this legacy value? As far as I know, ENOTCONN is only returned by the following functions:

  • recv, recvfrom
  • send, sendto
  • shutdown

Ready to be reviewed.

@@ -50,7 +50,7 @@ char* WiiSockMan::DecodeError(s32 ErrorCode)
#endif
}

static s32 TranslateErrorCode(s32 native_error, bool isRW)
static s32 TranslateErrorCode(s32 native_error, bool is_rw)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know nothing about this code. Is is_rw mean "read"/"write"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It refers to read/write or rather send(to) and recv(from).

The following functions can return

  • EAGAIN/EWOULDBLOCK: send(to), recv(from), accept
  • EINPROGRESS: connect, bind
  • WSAEWOULDBLOCK: send(to), recv(from), accept, connect

It is used below to correct windows error codes WSAEWOULDBLOCK as it can be used in functions which don't return EAGAIN/EWOULDBLOCK but EINPROGRESS on Linux. Basically, the Linux code path will always return -SO_EAGAIN

I can add a comment about it if you want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be more the naming than the usage. Not too sure if spelling out the words would help tho...

@sepalani
Copy link
Contributor Author

Rebased on latest master, I also added a comment regarding is_rw.

@delroth delroth merged commit ebd08c8 into dolphin-emu:master Jun 19, 2020
@sepalani sepalani deleted the so-econn branch June 26, 2020 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants