Skip to content

Instantly share code, notes, and snippets.

@shaxbee
Created April 27, 2016 03:47
Show Gist options
  • Save shaxbee/a87e2c028a21c60e5aace593a23b27a1 to your computer and use it in GitHub Desktop.
Save shaxbee/a87e2c028a21c60e5aace593a23b27a1 to your computer and use it in GitHub Desktop.
Wrapper for grpc ServerStream providing context override
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