This commit is contained in:
crusader 2017-11-09 15:17:01 +09:00
parent 1429e17a4d
commit 8f0c07d9cf

View File

@ -98,7 +98,7 @@ func handleServer(s *server) {
defer s.stopWg.Done() defer s.stopWg.Done()
if err := s.httpServer.Serve(s.listener); nil != err { if err := s.httpServer.Serve(s.listener); nil != err {
logging.Logger.Error(fmt.Sprintf("Server: Server err - %v", err)) logging.Logger().Error(fmt.Sprintf("Server: Server err - %v", err))
} }
}() }()
@ -150,7 +150,7 @@ func (s *server) handleError(ctx *fasthttp.RequestCtx, status int, reason error)
func handleConnection(s *server, soc *Socket, socketHandler SocketHandler) { func handleConnection(s *server, soc *Socket, socketHandler SocketHandler) {
defer s.stopWg.Done() defer s.stopWg.Done()
logging.Logger.Debug(fmt.Sprintf("Server: Client[%s] is connected.", soc.RemoteAddr())) logging.Logger().Debug(fmt.Sprintf("Server: Client[%s] is connected.", soc.RemoteAddr()))
clientStopChan := make(chan struct{}) clientStopChan := make(chan struct{})
handleDoneChan := make(chan struct{}) handleDoneChan := make(chan struct{})
@ -163,7 +163,7 @@ func handleConnection(s *server, soc *Socket, socketHandler SocketHandler) {
<-handleDoneChan <-handleDoneChan
case <-handleDoneChan: case <-handleDoneChan:
close(clientStopChan) close(clientStopChan)
logging.Logger.Debug(fmt.Sprintf("Server: Client[%s] is disconnected.", soc.RemoteAddr())) logging.Logger().Debug(fmt.Sprintf("Server: Client[%s] is disconnected.", soc.RemoteAddr()))
soc.Close() soc.Close()
} }
} }