From 86ec6baad9142650777c5ff031835d65fb92bb97 Mon Sep 17 00:00:00 2001 From: Cesar Ghali Date: Tue, 11 Jul 2017 13:56:13 -0700 Subject: [PATCH] Populate callInfo.peer object for streaming RPCs (#1356) --- stream.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stream.go b/stream.go index 30374afa649a..1c621ba875a2 100644 --- a/stream.go +++ b/stream.go @@ -29,6 +29,7 @@ import ( "golang.org/x/net/trace" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" "google.golang.org/grpc/transport" @@ -221,6 +222,10 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth } break } + // Set callInfo.peer object from stream's context. + if peer, ok := peer.FromContext(s.Context()); ok { + c.peer = peer + } cs := &clientStream{ opts: opts, c: c,