mirror of https://github.com/grpc/grpc-java.git
netty: only add gRPC negotiator once SSL is established
This commit is contained in:
parent
36670c1fcd
commit
417765b814
|
|
@ -611,7 +611,7 @@ public final class ProtocolNegotiators {
|
||||||
|
|
||||||
BufferUntilTlsNegotiatedHandler(
|
BufferUntilTlsNegotiatedHandler(
|
||||||
ChannelHandler bootstrapHandler, GrpcHttp2ConnectionHandler grpcHandler) {
|
ChannelHandler bootstrapHandler, GrpcHttp2ConnectionHandler grpcHandler) {
|
||||||
super(bootstrapHandler, grpcHandler);
|
super(bootstrapHandler);
|
||||||
this.grpcHandler = grpcHandler;
|
this.grpcHandler = grpcHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -630,6 +630,10 @@ public final class ProtocolNegotiators {
|
||||||
// Successfully negotiated the protocol.
|
// Successfully negotiated the protocol.
|
||||||
logSslEngineDetails(Level.FINER, ctx, "TLS negotiation succeeded.", null);
|
logSslEngineDetails(Level.FINER, ctx, "TLS negotiation succeeded.", null);
|
||||||
|
|
||||||
|
// Wait until negotiation is complete to add gRPC. If added too early, HTTP/2 writes
|
||||||
|
// will fail before we see the userEvent, and the channel is closed down prematurely.
|
||||||
|
ctx.pipeline().addBefore(ctx.name(), null, grpcHandler);
|
||||||
|
|
||||||
// Successfully negotiated the protocol.
|
// Successfully negotiated the protocol.
|
||||||
// Notify about completion and pass down SSLSession in attributes.
|
// Notify about completion and pass down SSLSession in attributes.
|
||||||
grpcHandler.handleProtocolNegotiationCompleted(
|
grpcHandler.handleProtocolNegotiationCompleted(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue