private void Close(string msg) { bool connected = false; if (m_client != null) { connected = true; m_client.Close(); m_client = null; m_kcp = null; if (s_updateList.Contains(this)) { s_updateList.Remove(this); } } if (connected) { m_msgProtocol.Reset(); DispatchEvent(SocketEvent.DISCONNECT, msg); } }