Merge pull request #361 from iamqizhao/fix
bug fix: do not access RemoteAddr on nil net.Conn
This commit is contained in:
@ -229,7 +229,8 @@ func (s *Server) Serve(lis net.Listener) error {
|
|||||||
}
|
}
|
||||||
var authInfo credentials.AuthInfo
|
var authInfo credentials.AuthInfo
|
||||||
if creds, ok := s.opts.creds.(credentials.TransportAuthenticator); ok {
|
if creds, ok := s.opts.creds.(credentials.TransportAuthenticator); ok {
|
||||||
c, authInfo, err = creds.ServerHandshake(c)
|
var conn net.Conn
|
||||||
|
conn, authInfo, err = creds.ServerHandshake(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
s.errorf("ServerHandshake(%q) failed: %v", c.RemoteAddr(), err)
|
s.errorf("ServerHandshake(%q) failed: %v", c.RemoteAddr(), err)
|
||||||
@ -237,6 +238,7 @@ func (s *Server) Serve(lis net.Listener) error {
|
|||||||
grpclog.Println("grpc: Server.Serve failed to complete security handshake.")
|
grpclog.Println("grpc: Server.Serve failed to complete security handshake.")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
c = conn
|
||||||
}
|
}
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
if s.conns == nil {
|
if s.conns == nil {
|
||||||
|
Reference in New Issue
Block a user