public void Stop() { PermaDisconnected = true; JHSNetworkClient.Instance.ClientConnected = false; Connected = false; JHSStatisiticsManager.Remove(connection); connection.Dispose(); }
public bool Disconnect(JHSConnection con) { JHSNetworkClient.Instance.ClientConnected = false; if (con != null) { JHSNetworkClient.PushMessage(new JHSNetworkMessage { msgType = RecconectTry == m_RecconectTry ? InternalMessages.DISCONNECT : InternalMessages.DISCONNECT_BUT_WILL_RECONNECT, conn = con, reader = new JHSNetworkReader() }); JHSStatisiticsManager.Remove(con); con.Dispose(); Connected = false; LastTryToConnect = JHSTime.Time + NetConfig.ReconnectTimeOut; return(true); } LastTryToConnect = JHSTime.Time + NetConfig.ReconnectTimeOut; Connected = false; return(false); }
public bool Disconnect(JHSConnection con) { if (con != null) { uint conId = con.connectionId; JHSNetworkServer.PushMessage(new JHSNetworkMessage { msgType = InternalMessages.DISCONNECT, conn = con, reader = new JHSNetworkReader() }); JHSStatisiticsManager.Remove(con); lock (m_Connections) { if (m_Connections.ContainsKey(conId)) { m_Connections.Remove(conId); } } con.Dispose(); } return(true); }