-
Notifications
You must be signed in to change notification settings - Fork 416
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
Expose listening address on HTTP2 server transport #1933
Expose listening address on HTTP2 server transport #1933
Conversation
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *) | ||
public struct Posix: ServerTransport { | ||
private let address: GRPCHTTP2Core.SocketAddress | ||
private let config: Config | ||
private let eventLoopGroup: MultiThreadedEventLoopGroup | ||
private let serverQuiescingHelper: ServerQuiescingHelper | ||
|
||
private let listeningAddressPromise: | ||
_LockedValueBox<EventLoopPromise<GRPCHTTP2Core.SocketAddress>> |
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.
This is slightly annoying, but I backed this by a box containing the promise because I didn't want to make listen
a mutating func, and I need to mutate the promise when we exit listen
's scope.
Sources/GRPCHTTP2TransportNIOPosix/GRPCHTTP2TransportNIOPosix.swift
Outdated
Show resolved
Hide resolved
Sources/GRPCHTTP2TransportNIOPosix/GRPCHTTP2TransportNIOPosix.swift
Outdated
Show resolved
Hide resolved
Sources/GRPCHTTP2TransportNIOPosix/GRPCHTTP2TransportNIOPosix.swift
Outdated
Show resolved
Hide resolved
f129b33
to
13de732
Compare
Sources/GRPCHTTP2TransportNIOPosix/HTTP2ServerTransport Posix.swift
Outdated
Show resolved
Hide resolved
Sources/GRPCHTTP2TransportNIOPosix/HTTP2ServerTransport Posix.swift
Outdated
Show resolved
Hide resolved
Sources/GRPCHTTP2TransportNIOPosix/HTTP2ServerTransport Posix.swift
Outdated
Show resolved
Hide resolved
Sources/GRPCHTTP2TransportNIOPosix/HTTP2ServerTransport Posix.swift
Outdated
Show resolved
Hide resolved
Sources/GRPCHTTP2Core/Internal/NIOSocketAddress GRPCSocketAddress.swift
Outdated
Show resolved
Hide resolved
Sources/GRPCHTTP2Core/Internal/NIOSocketAddress GRPCSocketAddress.swift
Outdated
Show resolved
Hide resolved
Sources/GRPCHTTP2Core/Internal/NIOSocketAddress GRPCSocketAddress.swift
Outdated
Show resolved
Hide resolved
Sources/GRPCHTTP2TransportNIOPosix/HTTP2ServerTransport Posix.swift
Outdated
Show resolved
Hide resolved
Sources/GRPCHTTP2TransportNIOPosix/HTTP2ServerTransport Posix.swift
Outdated
Show resolved
Hide resolved
Tests/GRPCHTTP2TransportNIOPosixTests/HTTP2TransportNIOPosixTests.swift
Outdated
Show resolved
Hide resolved
Tests/GRPCHTTP2TransportNIOPosixTests/HTTP2TransportNIOPosixTests.swift
Outdated
Show resolved
Hide resolved
Tests/GRPCHTTP2TransportNIOPosixTests/HTTP2TransportNIOPosixTests.swift
Outdated
Show resolved
Hide resolved
Tests/GRPCHTTP2TransportNIOPosixTests/HTTP2TransportNIOPosixTests.swift
Outdated
Show resolved
Hide resolved
2d45390
to
092dbd3
Compare
092dbd3
to
0e2203a
Compare
Sources/GRPCHTTP2TransportNIOPosix/HTTP2ServerTransport Posix.swift
Outdated
Show resolved
Hide resolved
Tests/GRPCHTTP2TransportTests/HTTP2TransportNIOPosixTests.swift
Outdated
Show resolved
Hide resolved
Tests/GRPCHTTP2TransportTests/HTTP2TransportNIOPosixTests.swift
Outdated
Show resolved
Hide resolved
Tests/GRPCHTTP2TransportTests/HTTP2TransportNIOPosixTests.swift
Outdated
Show resolved
Hide resolved
Tests/GRPCHTTP2TransportTests/HTTP2TransportNIOPosixTests.swift
Outdated
Show resolved
Hide resolved
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.
LGTM, thanks Gus!
Motivation: We should expose the listening address on the H2 server transports so that our client can connect to it. Modifications: Exposed a `listeningAddress` async property. It will block until we bind or error, return the listening address while it's bound and listening, and throw an error when it's not listening anymore. Result: We can now know what address our server transport's listening on for requests.
Motivation
We should expose the listening address on the H2 server transports so that our client can connect to it.
Modifications
Exposed a
listeningAddress
async property. It will block until we bind or error, return the listening address while it's bound and listening, and throw an error when it's not listening anymore.Result
We can now know what address our server transport's listening on for requests.