Skip to content

Commit 0f1106e

Browse files
rubensfbwplotka
authored andcommitted
Move error checking further up (#34)
1 parent d5b35f6 commit 0f1106e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

proxy/handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ func (s *handler) handler(srv interface{}, serverStream grpc.ServerStream) error
6565
}
6666
// We require that the director's returned context inherits from the serverStream.Context().
6767
outgoingCtx, backendConn, err := s.director(serverStream.Context(), fullMethodName)
68-
clientCtx, clientCancel := context.WithCancel(outgoingCtx)
6968
if err != nil {
7069
return err
7170
}
71+
72+
clientCtx, clientCancel := context.WithCancel(outgoingCtx)
7273
// TODO(mwitkow): Add a `forwarded` header to metadata, https://en.wikipedia.org/wiki/X-Forwarded-For.
7374
clientStream, err := grpc.NewClientStream(clientCtx, clientStreamDescForProxying, backendConn, fullMethodName)
7475
if err != nil {

0 commit comments

Comments
 (0)