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

Fix event created for WSAEventSelect #2750

Merged
merged 1 commit into from
Jul 2, 2015

Conversation

realjiangms
Copy link
Contributor

Fix event created for WSAEventSelect: The event we pass to WSAEventSelect should be WSAEVENT instead of normal event.

From MSDN, it looks same as CreateEvent(NULL, FALSE, FALSE, NULL):
The WSACreateEvent function creates a manual-reset event object with an initial state of nonsignaled. The event object is unnamed.
However they are not really equivalent. When we use normal event, the WSAEventSelect still works but the event appears to be 'auto-reset'.

On my Win7 in labtop and Win7 in virtual machine, the client connection always stuck because the WSA event is 'consumed' by WaitForMultipleObjects and the later WaitForSingleObject only get a 'timeout'

I found this issue when testing shadow server on win7.

…lect should be WSAEVENT instead of normal event.

From MSDN, it looks same as CreateEvent(NULL, FALSE, FALSE, NULL):
	The WSACreateEvent function creates a manual-reset event object with an initial state of nonsignaled. The event object is unnamed.
However they are not really equivalent. When we use normal event, the WSAEventSelect still works but the event appears to be 'auto-reset'.
@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/533/
Test PASSed.

@akallabeth
Copy link
Member

@realjiangms According to MSDN CreateEvent(NULL, TRUE, FALSE, NULL) would be equivalent.

Good catch though, +1

@mfleisz
Copy link
Member

mfleisz commented Jul 1, 2015

+1

1 similar comment
@hardening
Copy link
Contributor

+1

hardening added a commit that referenced this pull request Jul 2, 2015
Fix event created for WSAEventSelect
@hardening hardening merged commit ac93b26 into FreeRDP:master Jul 2, 2015
realjiangms added a commit to realjiangms/FreeRDP that referenced this pull request Sep 3, 2015
…d by FreeRDP#2750.

We used to fall in lool after FreeRDP#2750. The reason is that we attach to FD_WRITE event. This should not be expected. Because WSAEventSelect attaches to FD_WRITE, it is always in 'set' state even when we drain the read buffer.
It was first fixed in PR FreeRDP#2770. However the solution introduced another issue on Linux. This PR discards the fix in FreeRDP#2770
Later A quick fix for FreeRDP#2770 was introduced in FreeRDP#2790/FreeRDP#2791. It is also discarded together.
realjiangms added a commit to realjiangms/FreeRDP that referenced this pull request Sep 3, 2015
…d by FreeRDP#2750.

We used to fall in lool after 2750. The reason is that we attach to FD_WRITE event. This should not be expected. Because WSAEventSelect attaches to FD_WRITE, it is always in 'set' state even when we drain the read buffer.
It was first fixed in PR 2770. However the solution introduced another issue on Linux. This PR discards the fix in 2770
Later A quick fix for 2770 was introduced in 2790/2791. It is also discarded together.
realjiangms added a commit to realjiangms/FreeRDP that referenced this pull request Sep 4, 2015
1. Fix socket event (created by WSAEventCreate) handling for win32. This is to fix the issue which uncovered by FreeRDP#2750.
We used to fall in loop after 2750. The reason is event created by WSAEventSelect on windows need manually reset, it is always in 'set' state even when we run out of the read buffer.
It was first fixed in PR 2770. However the solution introduced another issue on Linux. This PR discards the fix in 2770
Later A quick fix for 2770 was introduced in 2790/2791. It is also discarded together.
This fix try to keep usage same on Windows and Posix.
2. Fix argument for WSAEventSelect on win32 to be consistent with Linux.
3. Fix tcp event for listener.
realjiangms added a commit to realjiangms/FreeRDP that referenced this pull request Sep 5, 2015
1. Fix socket event (created by WSAEventCreate) handling for win32. This is to fix the issue which uncovered by FreeRDP#2750.
We used to fall in loop after 2750. The reason is event created by WSAEventSelect on windows need manually reset, it is always in 'set' state even when we run out of the read buffer.
It was first fixed in PR 2770. However the solution introduced another issue on Linux. This PR discards the fix in 2770
Later A quick fix for 2770 was introduced in 2790/2791. It is also discarded together.
This fix try to keep usage same on Windows and Posix.
2. Fix argument for WSAEventSelect on win32 to be consistent with Linux.
3. Fix tcp event for listener.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants