This commit is contained in:
crusader 2017-11-09 15:15:00 +09:00
parent 5edc46cefe
commit 07300537c2

View File

@ -88,7 +88,7 @@ func handleServer(s *server) {
go func() {
if conn, err = s.listener.Accept(); err != nil {
if stopping.Load() == nil {
logging.Logger.Error(fmt.Sprintf("Server: Cannot accept new connection: [%s]", err))
logging.Logger().Error(fmt.Sprintf("Server: Cannot accept new connection: [%s]", err))
}
} else {
conn, err = s.sh.OnAccept(conn)
@ -124,7 +124,7 @@ func handleServer(s *server) {
func handleConnection(s *server, conn net.Conn) {
defer s.stopWg.Done()
logging.Logger.Debug(fmt.Sprintf("Server: Client[%s] is connected.", conn.RemoteAddr()))
logging.Logger().Debug(fmt.Sprintf("Server: Client[%s] is connected.", conn.RemoteAddr()))
clientStopChan := make(chan struct{})
handleDoneChan := make(chan struct{})
go s.sh.Handle(conn, clientStopChan, handleDoneChan)
@ -137,6 +137,6 @@ func handleConnection(s *server, conn net.Conn) {
case <-handleDoneChan:
close(clientStopChan)
conn.Close()
logging.Logger.Debug(fmt.Sprintf("Server: Client[%s] is disconnected.", conn.RemoteAddr()))
logging.Logger().Debug(fmt.Sprintf("Server: Client[%s] is disconnected.", conn.RemoteAddr()))
}
}