/// <summary> /// Callback for when a connection had disconnected /// </summary> private void MasterClient_OnDisconnect(MasterClient client) { // Remove client, and call OnUpdate Event try { // Release this stream's AsyncEventArgs to the object pool base.Release(client.Stream); // Remove client from online list if (Clients.TryRemove(client.ConnectionId, out client) && !client.Disposed) { client.Dispose(); } } catch (Exception e) { Program.ErrorLog.Write("An Error occured at [MasterServer.OnDisconnect] : Generating Exception Log"); ExceptionHandler.GenerateExceptionLog(e); } }
/// <summary> /// Accepts a TcpClient, and begin the serverlist fetching process for the client. /// This method is executed when the user updates his server browser ingame /// </summary> protected override void ProcessAccept(GamespyTcpStream Stream) { // End the operation and display the received data on // the console. try { // Convert the TcpClient to a MasterClient MasterClient client = new MasterClient(Stream); Clients.TryAdd(client.ConnectionId, client); // Begin accepting data now that we are fully connected Stream.BeginReceive(); } catch (Exception e) { Program.ErrorLog.Write("WARNING: An Error occured at [MstrServer.AcceptClient] : Generating Exception Log"); ExceptionHandler.GenerateExceptionLog(e); base.Release(Stream); } }
/// <summary> /// Callback for when a connection had disconnected /// </summary> private void MasterClient_OnDisconnect(MasterClient client) { // Remove client, and call OnUpdate Event try { // Release this stream's AsyncEventArgs to the object pool base.Release(client.Stream); // Remove client from online list if (Clients.TryRemove(client.ConnectionId, out client) && !client.Disposed) client.Dispose(); } catch (Exception e) { Program.ErrorLog.Write("An Error occured at [MasterServer.OnDisconnect] : Generating Exception Log"); ExceptionHandler.GenerateExceptionLog(e); } }