Skip to content

Conversation

@rmichela
Copy link
Contributor

@rmichela rmichela commented Feb 6, 2017

HandlerRegistry.lookupMethod(String methodName, String authority) is never never invoked with a non-null authority string. Per the discussion on the mailing list, I implemented this method.

https://groups.google.com/forum/#!topic/grpc-io/1RPka9CKAvE

@grpc-kokoro
Copy link

Thanks for your pull request. The automated tests will run as soon as one of the admins verifies this change is ok for us to run on our infrastructure.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@rmichela
Copy link
Contributor Author

rmichela commented Feb 6, 2017

I'm not done with this (style, tests, etc) but am looking for feedback on the concept. Am I going in the right direction here?

import io.grpc.internal.GrpcUtil;
import io.grpc.internal.ServerTransportListener;
import io.grpc.internal.StatsTraceContext;
import io.grpc.internal.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't do * style imports.

ServerMethodDefinition<?, ?> method = registry.lookupMethod(methodName);
if (method == null) {
method = fallbackRegistry.lookupMethod(methodName);
String authority = stream.getAttributes()
Copy link
Contributor

Choose a reason for hiding this comment

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

Attributes.newBuilder(Attributes)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand this comment. Can you elaborate?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, that should be in NettyServerHandler.java line 197

this, http2Stream, maxMessageSize, statsTraceCtx);
NettyServerStream stream = new NettyServerStream(ctx.channel(), state, attributes,
Attributes attributesWithAuthority = Attributes
.newBuilder()
Copy link
Contributor

Choose a reason for hiding this comment

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

This file is not particularly good about following the rule, but line continuation should be +4.

NettyServerStream stream = new NettyServerStream(ctx.channel(), state, attributes,
Attributes attributesWithAuthority = Attributes
.newBuilder()
.setAll(attributes).set(ServerImpl.ATTR_AUTHORITY, headers.authority().toString())
Copy link
Contributor

Choose a reason for hiding this comment

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

This is going to add extra allocation and AsciiString conversion in the serving path, where there was none before. Almost no users need this data. This would slow down all servers for the sake of proxies.

Copy link
Contributor Author

@rmichela rmichela Feb 6, 2017

Choose a reason for hiding this comment

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

Is there a cleaner way to get authority up to the callbackRegistry that doesn't involve passing authority along the server path?

@rmichela
Copy link
Contributor Author

rmichela commented Feb 7, 2017

HandlerRegistry is still experimental. In light of #2235 do you see it's API moving away from exposing authority?

@rmichela
Copy link
Contributor Author

rmichela commented Feb 8, 2017

Per discussion with @ejona86 on IRC, I've re-attempted this PR using a different approach.

New PR in #2709

@rmichela rmichela closed this Feb 8, 2017
@rmichela rmichela deleted the feature/HandlerRegistry-authority branch February 8, 2017 00:58
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants