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

Adopt Sendable for types in NIOHTTP1 #2213

Merged
merged 10 commits into from
Jul 4, 2022

Conversation

dnadoba
Copy link
Member

@dnadoba dnadoba commented Jun 30, 2022

Incremental Sendable adoption

@@ -36,7 +36,7 @@ internal enum KeepAliveState {

/// A representation of the request line and header fields of a HTTP request.
public struct HTTPRequestHead: Equatable {
private final class _Storage {
fileprivate final class _Storage {
Copy link
Member Author

Choose a reason for hiding this comment

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

I change the access level from private to fileprivate to be able to mark _Storage as non-sendable which is only possible in an extension. No strong optioned on that though, so happy to make it private again.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we don't need to mark internal types as non-sendable, so I'm happy for us to throw this away.

Copy link
Member Author

Choose a reason for hiding this comment

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

private again 9d78041

@dnadoba dnadoba changed the title Adopt Sendable in NIOHTTP1 Adopt Sendable for types in NIOHTTP1 Jun 30, 2022
@dnadoba dnadoba added the 🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0 label Jun 30, 2022
@@ -36,7 +36,7 @@ internal enum KeepAliveState {

/// A representation of the request line and header fields of a HTTP request.
public struct HTTPRequestHead: Equatable {
private final class _Storage {
fileprivate final class _Storage {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we don't need to mark internal types as non-sendable, so I'm happy for us to throw this away.

@@ -301,6 +301,10 @@ public final class NIOHTTPServerRequestAggregator: ChannelInboundHandler, Remova
}
}

#if swift(>=5.5) && canImport(_Concurrency)
extension NIOHTTPServerRequestAggregator: @unchecked Sendable {}
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no way this type is Sendable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ups 🫣... fixed in 9d78041



#if swift(>=5.5) && canImport(_Concurrency)
extension NIOHTTPClientResponseAggregator: @unchecked Sendable {}
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no way this type is Sendable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ups 🫣... fixed in 9d78041

@dnadoba dnadoba force-pushed the dn-sendable-http1-types branch 2 times, most recently from b9f1884 to 9d78041 Compare July 1, 2022 12:50
Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

Nice work!

@Lukasa Lukasa enabled auto-merge (squash) July 4, 2022 07:21
@Lukasa Lukasa merged commit 0abf7eb into apple:main Jul 4, 2022
@dnadoba dnadoba deleted the dn-sendable-http1-types branch July 5, 2022 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants