Skip to content

Commit 81a67c4

Browse files
committed
git add proxy
1 parent 67591eb commit 81a67c4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.DS_Store

6 KB
Binary file not shown.

proxy/handler.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
package proxy
55

66
import (
7+
"fmt"
78
"io"
89

910
"golang.org/x/net/context"
1011
"google.golang.org/grpc"
1112
"google.golang.org/grpc/codes"
12-
"google.golang.org/grpc/transport"
13+
// "google.golang.org/grpc/transport"
14+
// "google.golang.org/grpc/transport"
1315
)
1416

1517
var (
@@ -59,11 +61,12 @@ type handler struct {
5961
// It is invoked like any gRPC server stream and uses the gRPC server framing to get and receive bytes from the wire,
6062
// forwarding it to a ClientStream established against the relevant ClientConn.
6163
func (s *handler) handler(srv interface{}, serverStream grpc.ServerStream) error {
64+
fmt.Println(serverStream.Context())
6265
// little bit of gRPC internals never hurt anyone
63-
lowLevelServerStream, ok := transport.StreamFromContext(serverStream.Context())
64-
if !ok {
65-
return grpc.Errorf(codes.Internal, "lowLevelServerStream not exists in context")
66-
}
66+
lowLevelServerStream := grpc.ServerTransportStreamFromContext(serverStream.Context())
67+
// if !ok {
68+
// return grpc.Errorf(codes.Internal, "lowLevelServerStream not exists in context")
69+
// }
6770
fullMethodName := lowLevelServerStream.Method()
6871
// We require that the director's returned context inherits from the serverStream.Context().
6972
outgoingCtx, backendConn, err := s.director(serverStream.Context(), fullMethodName)

0 commit comments

Comments
 (0)