aboutsummaryrefslogtreecommitdiff
path: root/netty/src/main/java/io/grpc/netty/NettyClientTransport.java
diff options
context:
space:
mode:
Diffstat (limited to 'netty/src/main/java/io/grpc/netty/NettyClientTransport.java')
-rw-r--r--netty/src/main/java/io/grpc/netty/NettyClientTransport.java28
1 files changed, 12 insertions, 16 deletions
diff --git a/netty/src/main/java/io/grpc/netty/NettyClientTransport.java b/netty/src/main/java/io/grpc/netty/NettyClientTransport.java
index 0020c54f5..7d963fc8e 100644
--- a/netty/src/main/java/io/grpc/netty/NettyClientTransport.java
+++ b/netty/src/main/java/io/grpc/netty/NettyClientTransport.java
@@ -28,7 +28,6 @@ import io.grpc.CallOptions;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
import io.grpc.Status;
-import io.grpc.internal.Channelz.Security;
import io.grpc.internal.Channelz.SocketStats;
import io.grpc.internal.ClientStream;
import io.grpc.internal.ConnectionClientTransport;
@@ -80,7 +79,6 @@ class NettyClientTransport implements ConnectionClientTransport {
private final long keepAliveTimeoutNanos;
private final boolean keepAliveWithoutCalls;
private final Runnable tooManyPingsRunnable;
-
private ProtocolNegotiator.Handler negotiationHandler;
private NettyClientHandler handler;
// We should not send on the channel until negotiation completes. This is a hard requirement
@@ -320,26 +318,14 @@ class NettyClientTransport implements ConnectionClientTransport {
if (channel.eventLoop().inEventLoop()) {
// This is necessary, otherwise we will block forever if we get the future from inside
// the event loop.
- result.set(
- new SocketStats(
- transportTracer.getStats(),
- channel.localAddress(),
- channel.remoteAddress(),
- Utils.getSocketOptions(channel),
- new Security()));
+ result.set(getStatsHelper(channel));
return result;
}
channel.eventLoop().submit(
new Runnable() {
@Override
public void run() {
- result.set(
- new SocketStats(
- transportTracer.getStats(),
- channel.localAddress(),
- channel.remoteAddress(),
- Utils.getSocketOptions(channel),
- new Security()));
+ result.set(getStatsHelper(channel));
}
})
.addListener(
@@ -354,6 +340,16 @@ class NettyClientTransport implements ConnectionClientTransport {
return result;
}
+ private SocketStats getStatsHelper(Channel ch) {
+ assert ch.eventLoop().inEventLoop();
+ return new SocketStats(
+ transportTracer.getStats(),
+ channel.localAddress(),
+ channel.remoteAddress(),
+ Utils.getSocketOptions(ch),
+ handler == null ? null : handler.getSecurityInfo());
+ }
+
@VisibleForTesting
Channel channel() {
return channel;