From 64216d22c4896748dedc499f036d5aeb858c5a4e Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 8 Nov 2017 19:17:56 +0900 Subject: [PATCH] ing --- server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.go b/server.go index b80b809..8474920 100644 --- a/server.go +++ b/server.go @@ -135,7 +135,7 @@ func (s *server) handleRequest(ctx *fasthttp.RequestCtx) { soc := newSocket(conn, socketHandler) s.stopWg.Add(1) - handleConnection(s, soc) + handleConnection(s, soc, socketHandler) }) } @@ -147,14 +147,14 @@ func (s *server) handleError(ctx *fasthttp.RequestCtx, status int, reason error) s.sh.OnError(ctx, status, reason) } -func handleConnection(s *server, soc *Socket) { +func handleConnection(s *server, soc *Socket, socketHandler SocketHandler) { defer s.stopWg.Done() logging.Logger.Debug(fmt.Sprintf("Server: Client[%s] is connected.", soc.RemoteAddr())) clientStopChan := make(chan struct{}) handleDoneChan := make(chan struct{}) - go soc.sh.Handle(soc, clientStopChan, handleDoneChan) + go socketHandler.Handle(soc, clientStopChan, handleDoneChan) select { case <-s.stopChan: