-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
WebSocket: fix bad assert, unstick shutdown #10366
Conversation
Reported-by: Stanley Wucw Fixes #10347
As this mode uses blocking sockets, it must set them back to non-blocking in disconnect to avoid the risk of getting stuck.
As this mode uses blocking sockets, it must set them back to non-blocking in disconnect to avoid the risk of getting stuck. Closes #10366
@@ -479,7 +479,6 @@ CURL_EXTERN CURLcode curl_ws_recv(struct Curl_easy *data, void *buffer, | |||
|
|||
/* update buffer and frame info */ | |||
wsp->frame.offset += datalen; | |||
DEBUGASSERT(wsp->frame.bytesleft >= (curl_off_t)datalen); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this assert is bad by itself, as long as the following two lines is there. The assert protects bytesleft from ever going negative in the subtraction two lines down. With the assert gone, it's possible for bytesleft to go negative which I don't think is the intention but shows that the assumptions are wrong somewhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this reproducer case, bytelength was zero at this point, so the assert() was clearly not doing a good job at that position at least. But sure, maybe it would work better in the conditional block just before the subtraction is done.
We can always add more asserts when we go about and continue to debug this functionality.
Reported-by: Stanley Wucw Fixes curl#10347 Closes curl#10366
As this mode uses blocking sockets, it must set them back to non-blocking in disconnect to avoid the risk of getting stuck. Closes curl#10366
No description provided.