Skip to content

Commit

Permalink
*: revert pingcap#756, use gRPC 1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
july2993 committed Oct 21, 2019
1 parent a8cfbfb commit b66538a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
5 changes: 1 addition & 4 deletions drainer/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,7 @@ func (s *Server) Start() error {
return errors.Annotatef(err, "fail to start TCP listener on %s", tcpURL.Host)
}
m := cmux.New(tcpLis)
grpcL := m.MatchWithWriters(
cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"),
cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc+proto"),
)
grpcL := m.Match(cmux.HTTP2HeaderField("content-type", "application/grpc"))
httpL := m.Match(cmux.HTTP1Fast())

// register drainer server with gRPC server and start to serve listener
Expand Down
6 changes: 5 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/gogo/protobuf v1.2.0
github.com/golang/mock v1.2.0
github.com/golang/protobuf v1.3.1
github.com/google/go-cmp v0.2.0 // indirect
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf
github.com/gorilla/mux v1.6.2
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d
Expand All @@ -36,12 +37,15 @@ require (
github.com/unrolled/render v0.0.0-20180914162206-b9786414de4d
github.com/zanmato1984/clickhouse v1.3.4-0.20181106115746-3e9a6b9beb12
go.uber.org/zap v1.9.1
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
golang.org/x/sync v0.0.0-20190423024810-112230192c58
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
google.golang.org/grpc v1.23.0
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 // indirect
google.golang.org/grpc v1.17.0
gopkg.in/jcmturner/goidentity.v3 v3.0.0 // indirect
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect
)

go 1.13
5 changes: 2 additions & 3 deletions pump/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,8 @@ func (p *pumpNode) Notify(ctx context.Context) error {
}

dialerOpts := []grpc.DialOption{
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
dialer := net.Dialer{}
return dialer.DialContext(ctx, "tcp", addr)
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout("tcp", addr, timeout)
}),
grpc.WithInsecure(),
grpc.WithBlock(),
Expand Down
6 changes: 1 addition & 5 deletions pump/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,7 @@ func (s *Server) Start() error {
// sets a timeout for the read of matchers
m.SetReadTimeout(time.Second * 10)

// grpcL := m.Match(cmux.HTTP2HeaderField("content-type", "application/grpc"))
grpcL := m.MatchWithWriters(
cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"),
cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc+proto"),
)
grpcL := m.Match(cmux.HTTP2HeaderField("content-type", "application/grpc"))

httpL := m.Match(cmux.HTTP1Fast())
go s.gs.Serve(grpcL)
Expand Down

0 comments on commit b66538a

Please sign in to comment.