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

Make the remote address available on the server interceptor context #1081

Merged
merged 1 commit into from
Dec 16, 2020

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Dec 16, 2020

Motivation:

Sometimes, if you're an interceptor, it's useful to know who you're
talking too.

Modifications:

  • Make the 'remoteAddress' available on the 'ServerInterceptorContext'

Result:

Users can access the remote address from server interceptors.

Motivation:

Sometimes, if you're an interceptor, it's useful to know who you're
talking too.

Modifications:

- Make the 'remoteAddress' available on the 'ServerInterceptorContext'

Result:

Users can access the remote address from server interceptors.
@glbrntt glbrntt added the 🆕 semver/minor Adds new public API. label Dec 16, 2020
@@ -111,6 +111,7 @@ internal final class HTTP2ToRawGRPCServerCodec: ChannelDuplexHandler {
headers: payload.headers,
eventLoop: context.eventLoop,
errorDelegate: self.errorDelegate,
remoteAddress: context.channel.remoteAddress,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Lukasa given this is in channelRead is it safe to force unwrap this optional?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, not all channels can answer this question.

@glbrntt glbrntt requested a review from Lukasa December 16, 2020 14:13
@@ -111,6 +111,7 @@ internal final class HTTP2ToRawGRPCServerCodec: ChannelDuplexHandler {
headers: payload.headers,
eventLoop: context.eventLoop,
errorDelegate: self.errorDelegate,
remoteAddress: context.channel.remoteAddress,
Copy link
Collaborator

Choose a reason for hiding this comment

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

No, not all channels can answer this question.

@glbrntt glbrntt merged commit 976a148 into grpc:main Dec 16, 2020
@glbrntt glbrntt deleted the gb-server-context-info branch December 16, 2020 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants