fix a nil map access bug

This commit is contained in:
iamqizhao
2016-01-28 18:51:38 -08:00
parent 35db64de36
commit 9ec0eadc55

View File

@ -274,7 +274,12 @@ func (s *Server) Serve(lis net.Listener) error {
grpclog.Println("grpc: Server.Serve failed to create ServerTransport: ", err)
return
}
defer st.Close()
s.mu.Lock()
if s.conns == nil {
s.mu.Unlock()
return
}
s.conns[st] = true
s.mu.Unlock()
var wg sync.WaitGroup