From 52c900f0a20ad635b4515ff5f67f9e32c43a77a1 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 27 Oct 2017 14:33:35 +0900 Subject: [PATCH] ing --- server.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/server.go b/server.go index a7ec306..784ad0e 100644 --- a/server.go +++ b/server.go @@ -3,7 +3,6 @@ package server import ( "fmt" "io" - "log" "net" "sync" "sync/atomic" @@ -120,18 +119,18 @@ func runServer(s *server) { func handleConnection(s *server, conn io.ReadWriteCloser, clientAddr string) { defer s.stopWg.Done() - log.Printf("Connected: %s", clientAddr) - stopChan := make(chan struct{}) - go s.serverHandler.Handle(clientAddr, conn, stopChan) + logging.Logger.Debug(fmt.Sprintf("Server: Client[%s] is connected.", clientAddr)) + clientStopChan := make(chan struct{}) + go s.serverHandler.Handle(clientAddr, conn, clientStopChan) select { case <-s.stopChan: - close(stopChan) + close(clientStopChan) conn.Close() return - case <-stopChan: + case <-clientStopChan: conn.Close() - log.Printf("Disconnected: %s", clientAddr) + logging.Logger.Debug(fmt.Sprintf("Server: Client[%s] is disconnected.", clientAddr)) return } }