Merge pull request 'dont init twice tls listener' (#167) from tls into v3
Reviewed-on: #167
This commit is contained in:
commit
786bbb7185
12
grpc.go
12
grpc.go
@ -26,7 +26,6 @@ import (
|
|||||||
"golang.org/x/net/netutil"
|
"golang.org/x/net/netutil"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/credentials"
|
|
||||||
"google.golang.org/grpc/encoding"
|
"google.golang.org/grpc/encoding"
|
||||||
gmetadata "google.golang.org/grpc/metadata"
|
gmetadata "google.golang.org/grpc/metadata"
|
||||||
"google.golang.org/grpc/peer"
|
"google.golang.org/grpc/peer"
|
||||||
@ -140,10 +139,6 @@ func (g *Server) configure(opts ...server.Option) error {
|
|||||||
grpc.UnknownServiceHandler(g.handler),
|
grpc.UnknownServiceHandler(g.handler),
|
||||||
}
|
}
|
||||||
|
|
||||||
if creds := g.getCredentials(); creds != nil {
|
|
||||||
gopts = append(gopts, grpc.Creds(creds))
|
|
||||||
}
|
|
||||||
|
|
||||||
if opts := g.getGrpcOptions(); opts != nil {
|
if opts := g.getGrpcOptions(); opts != nil {
|
||||||
gopts = append(opts, gopts...)
|
gopts = append(opts, gopts...)
|
||||||
}
|
}
|
||||||
@ -180,13 +175,6 @@ func (g *Server) getMaxMsgSize() int {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Server) getCredentials() credentials.TransportCredentials {
|
|
||||||
if g.opts.TLSConfig != nil {
|
|
||||||
return credentials.NewTLS(g.opts.TLSConfig)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Server) getGrpcOptions() []grpc.ServerOption {
|
func (g *Server) getGrpcOptions() []grpc.ServerOption {
|
||||||
if g.opts.Context == nil {
|
if g.opts.Context == nil {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user