From 5b37f9241178f8b20fae94a87218723e4a3eac3f Mon Sep 17 00:00:00 2001 From: crusader Date: Tue, 4 Sep 2018 18:45:36 +0900 Subject: [PATCH] ing --- socket/server-readwriter.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/socket/server-readwriter.go b/socket/server-readwriter.go index 7640e45..303d984 100644 --- a/socket/server-readwriter.go +++ b/socket/server-readwriter.go @@ -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 })