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

Await connection and flush before closing socket. #1532

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

dom96
Copy link
Collaborator

@dom96 dom96 commented Jan 12, 2024

Repeat of https://github.com/cloudflare/workerd/pull/1369/files with some changes.

Behind an autogate so we can roll this out gradually.

Tested upstream.

@dom96 dom96 force-pushed the dominik/flush-on-socket-close-2 branch from 634a33a to f19b959 Compare January 18, 2024 14:37
@dom96
Copy link
Collaborator Author

dom96 commented Jan 18, 2024

@jasnell should be ready to go

@dom96 dom96 force-pushed the dominik/flush-on-socket-close-2 branch 3 times, most recently from be83106 to 9e00f8b Compare January 24, 2024 12:05
@@ -143,6 +147,10 @@ class ReadableStreamInternalController: public ReadableStreamController {
bool disturbed = false;
bool readPending = false;

// Used by Sockets code to signal to the ReadableStream that it should error when read from
// because the socket is currently being closed.
bool errorOnReadsDueToPendingClosure = false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Other idea is to stick it into the StreamState but there seems to be a bunch of code that checks for !StreamState.is<Unlocked> and I didn't want to mess with it.

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

LGTM but with a couple comments I'd prefer to see addressed first.

@dom96 dom96 force-pushed the dominik/flush-on-socket-close-2 branch from 9e00f8b to fd8d741 Compare January 24, 2024 15:54
@dom96 dom96 force-pushed the dominik/flush-on-socket-close-2 branch from fd8d741 to 9b89c8a Compare January 24, 2024 15:56
@dom96 dom96 merged commit f35d5a8 into main Jan 24, 2024
11 checks passed
@dom96 dom96 deleted the dominik/flush-on-socket-close-2 branch January 24, 2024 17:32
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.

2 participants