func (tcpClient *TcpClient) Close() { tcpClient.eventDispatch.Close() elog.LogSys(" close conn ") tcpClient.conn.Close() tcpClient.waitGroup.Wait() //关闭连接 elog.Flush() }
func (s *TcpServer) Exit() { s.eventDispatch.Close() s.stopChan <- false close(s.stopChan) elog.LogSys(" close new conn ch ") close(s.newConnCh) elog.LogSys(" end new conn ch ") elog.LogSys("wait...") s.waitGroup.Wait() elog.Flush() }