update
This commit is contained in:
@ -39,6 +39,7 @@ func NewTCPServer(address string, port string, log *log.Logger) *TCPServer {
|
||||
MsgChan: make(chan string),
|
||||
CmdChan: make(chan string),
|
||||
Log: log,
|
||||
Mutex: new(sync.Mutex),
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +88,6 @@ func (s *TCPServer) handleConnection() {
|
||||
s.Mutex.Lock()
|
||||
delete(s.Clients, s.Conn)
|
||||
s.Mutex.Unlock()
|
||||
s.Log.Infof("client %s disconnected", s.Conn.RemoteAddr().String())
|
||||
return
|
||||
}
|
||||
|
||||
@ -98,6 +98,7 @@ func (s *TCPServer) handleConnection() {
|
||||
s.Mutex.Lock()
|
||||
delete(s.Clients, s.Conn)
|
||||
s.Mutex.Unlock()
|
||||
s.Conn.Close()
|
||||
s.Log.Infof("client %s disconnected", s.Conn.RemoteAddr().String())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user