Skip to content

Commit 6e9994a

Browse files
author
Milan Vlcek
committed
Expose InternalServer as a transport attribute in ServerImpl
1 parent 31fdb6c commit 6e9994a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

core/src/main/java/io/grpc/internal/ServerImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@
9494
public final class ServerImpl extends io.grpc.Server implements InternalInstrumented<ServerStats> {
9595
private static final Logger log = Logger.getLogger(ServerImpl.class.getName());
9696
private static final ServerStreamListener NOOP_LISTENER = new NoopListener();
97+
private static final Attributes.Key<InternalServer> TRANSPORT_SERVER_ATTR =
98+
Attributes.Key.create("io.grpc.Grpc.TRANSPORT_ATTR_SERVER_TRANSPORT");
9799

98100
private final InternalLogId logId;
99101
private final ObjectPool<? extends Executor> executorPool;
@@ -438,6 +440,10 @@ public Attributes transportReady(Attributes attributes) {
438440
handshakeTimeoutFuture.cancel(false);
439441
handshakeTimeoutFuture = null;
440442

443+
final Attributes.Builder builder = attributes.toBuilder();
444+
builder.set(TRANSPORT_SERVER_ATTR, transportServer);
445+
attributes = builder.build();
446+
441447
for (ServerTransportFilter filter : transportFilters) {
442448
attributes = Preconditions.checkNotNull(filter.transportReady(attributes),
443449
"Filter %s returned null", filter);

0 commit comments

Comments
 (0)