ing
This commit is contained in:
parent
5edc46cefe
commit
07300537c2
|
@ -88,7 +88,7 @@ func handleServer(s *server) {
|
||||||
go func() {
|
go func() {
|
||||||
if conn, err = s.listener.Accept(); err != nil {
|
if conn, err = s.listener.Accept(); err != nil {
|
||||||
if stopping.Load() == 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 {
|
} else {
|
||||||
conn, err = s.sh.OnAccept(conn)
|
conn, err = s.sh.OnAccept(conn)
|
||||||
|
@ -124,7 +124,7 @@ func handleServer(s *server) {
|
||||||
func handleConnection(s *server, conn net.Conn) {
|
func handleConnection(s *server, conn net.Conn) {
|
||||||
defer s.stopWg.Done()
|
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{})
|
clientStopChan := make(chan struct{})
|
||||||
handleDoneChan := make(chan struct{})
|
handleDoneChan := make(chan struct{})
|
||||||
go s.sh.Handle(conn, clientStopChan, handleDoneChan)
|
go s.sh.Handle(conn, clientStopChan, handleDoneChan)
|
||||||
|
@ -137,6 +137,6 @@ func handleConnection(s *server, conn net.Conn) {
|
||||||
case <-handleDoneChan:
|
case <-handleDoneChan:
|
||||||
close(clientStopChan)
|
close(clientStopChan)
|
||||||
conn.Close()
|
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()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user