Created
April 27, 2016 03:47
-
-
Save shaxbee/a87e2c028a21c60e5aace593a23b27a1 to your computer and use it in GitHub Desktop.
Wrapper for grpc ServerStream providing context override
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package streamutil | |
import ( | |
"golang.org/x/net/context" | |
"google.golang.org/grpc" | |
) | |
struct serverStreamWithContext { | |
grpc.ServerStream | |
ctx context.Context | |
} | |
func (ss *serverStreamWithContext) Context() context.Context { | |
return ss.ctx | |
} | |
func ServerStreamWithContext(ss ServerStream, ctx context.Context) { | |
return &serverStreamWithContext{ss, ctx} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment