Skip to content

Commit

Permalink
*: match with writers for gRPC traffic
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
  • Loading branch information
hexfusion committed Aug 5, 2019
1 parent 98bbd56 commit bdeab15
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion embed/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func (e *Etcd) servePeers() (err error) {
for _, p := range e.Peers {
gs := v3rpc.Server(e.Server, peerTLScfg)
m := cmux.New(p.Listener)
go gs.Serve(m.Match(cmux.HTTP2()))
go gs.Serve(m.MatchWithWriters(cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc")))
srv := &http.Server{
Handler: grpcHandlerFunc(gs, ph),
ReadTimeout: 5 * time.Minute,
Expand Down
2 changes: 1 addition & 1 deletion embed/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (sctx *serveCtx) serve(
if sctx.serviceRegister != nil {
sctx.serviceRegister(gs)
}
grpcl := m.Match(cmux.HTTP2())
grpcl := m.MatchWithWriters(cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"))
go func() { errHandler(gs.Serve(grpcl)) }()

var gwmux *gw.ServeMux
Expand Down
2 changes: 1 addition & 1 deletion etcdmain/grpc_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func startGRPCProxy(cmd *cobra.Command, args []string) {
}
m := mustListenCMux(tlsinfo)

grpcl := m.Match(cmux.HTTP2())
grpcl := m.MatchWithWriters(cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"))
defer func() {
grpcl.Close()
plog.Infof("stopping listening for grpc-proxy client requests on %s", grpcProxyListenAddr)
Expand Down
2 changes: 1 addition & 1 deletion integration/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ func (m *member) Launch() error {
cm.SetReadTimeout(time.Second)

if m.grpcServer != nil {
grpcl := cm.Match(cmux.HTTP2())
grpcl := cm.MatchWithWriters(cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"))
go m.grpcServerPeer.Serve(grpcl)
}

Expand Down

0 comments on commit bdeab15

Please sign in to comment.