This commit is contained in:
crusader 2018-09-04 18:45:36 +09:00
parent 6d0ae76b5c
commit 5b37f92411

View File

@ -33,8 +33,6 @@ func (srw *ServerReadWriter) HandleConnection(servlet Servlet, servletCtx server
if nil != conn {
conn.Close()
}
servlet.OnDisconnect(servletCtx)
olog.Logger().Info("Client has been disconnected", zap.String("Address", addr.String()))
srw.ServerStopWg.Done()
}()
@ -46,6 +44,10 @@ func (srw *ServerReadWriter) HandleConnection(servlet Servlet, servletCtx server
servlet.OnConnect(servletCtx, conn)
conn.SetCloseHandler(func(code int, text string) error {
olog.Logger().Debug("close")
servlet.OnDisconnect(servletCtx)
olog.Logger().Info("Client has been disconnected", zap.String("Address", addr.String()))
return nil
})