Merge branch 'master' of https://github.com/grpc/grpc-go
This commit is contained in:
@ -151,14 +151,16 @@ func (c *tlsCreds) ClientHandshake(addr string, rawConn net.Conn, timeout time.D
|
|||||||
errChannel <- timeoutError{}
|
errChannel <- timeoutError{}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// use local cfg to avoid clobbering ServerName if using multiple endpoints
|
||||||
|
cfg := *c.config
|
||||||
if c.config.ServerName == "" {
|
if c.config.ServerName == "" {
|
||||||
colonPos := strings.LastIndex(addr, ":")
|
colonPos := strings.LastIndex(addr, ":")
|
||||||
if colonPos == -1 {
|
if colonPos == -1 {
|
||||||
colonPos = len(addr)
|
colonPos = len(addr)
|
||||||
}
|
}
|
||||||
c.config.ServerName = addr[:colonPos]
|
cfg.ServerName = addr[:colonPos]
|
||||||
}
|
}
|
||||||
conn := tls.Client(rawConn, c.config)
|
conn := tls.Client(rawConn, &cfg)
|
||||||
if timeout == 0 {
|
if timeout == 0 {
|
||||||
err = conn.Handshake()
|
err = conn.Handshake()
|
||||||
} else {
|
} else {
|
||||||
|
@ -214,7 +214,7 @@ func (s *serverReflectionServer) serviceMetadataForSymbol(name string) (interfac
|
|||||||
return nil, fmt.Errorf("unknown symbol: %v", name)
|
return nil, fmt.Errorf("unknown symbol: %v", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for method name in info.Methods.
|
// Search the method name in info.Methods.
|
||||||
var found bool
|
var found bool
|
||||||
for _, m := range info.Methods {
|
for _, m := range info.Methods {
|
||||||
if m.Name == name[pos+1:] {
|
if m.Name == name[pos+1:] {
|
||||||
|
@ -245,7 +245,7 @@ func (s *Server) register(sd *ServiceDesc, ss interface{}) {
|
|||||||
s.m[sd.ServiceName] = srv
|
s.m[sd.ServiceName] = srv
|
||||||
}
|
}
|
||||||
|
|
||||||
// MethodInfo contains information about an RPC.
|
// MethodInfo contains the information of an RPC including its method name and type.
|
||||||
type MethodInfo struct {
|
type MethodInfo struct {
|
||||||
// Name is the method name only, without the service name or package name.
|
// Name is the method name only, without the service name or package name.
|
||||||
Name string
|
Name string
|
||||||
@ -320,9 +320,11 @@ func (s *Server) Serve(lis net.Listener) error {
|
|||||||
s.lis[lis] = true
|
s.lis[lis] = true
|
||||||
s.mu.Unlock()
|
s.mu.Unlock()
|
||||||
defer func() {
|
defer func() {
|
||||||
lis.Close()
|
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
delete(s.lis, lis)
|
if s.lis != nil && s.lis[lis] {
|
||||||
|
lis.Close()
|
||||||
|
delete(s.lis, lis)
|
||||||
|
}
|
||||||
s.mu.Unlock()
|
s.mu.Unlock()
|
||||||
}()
|
}()
|
||||||
for {
|
for {
|
||||||
|
Reference in New Issue
Block a user