/// <summary> /// Callback for when a connection had disconnected /// </summary> /// <param name="sender">The client object whom is disconnecting</param> private void GpspClient_OnDisconnect(GpspClient client) { // Release this stream's AsyncEventArgs to the object pool base.Release(client.Stream); if (Clients.TryRemove(client.ConnectionId, out client) && !client.Disposed) { client.Dispose(); } }
/// <summary> /// When a new connection is established, we the parent class are responsible /// for handling the processing /// </summary> /// <param name="Stream">A GamespyTcpStream object that wraps the I/O AsyncEventArgs and socket</param> protected override void ProcessAccept(GamespyTcpStream Stream) { try { // Convert the TcpClient to a MasterClient GpspClient client = new GpspClient(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 [Gpsp.ProcessAccept] : Generating Exception Log"); ExceptionHandler.GenerateExceptionLog(e); base.Release(Stream); } }
/// <summary> /// When a new connection is established, we the parent class are responsible /// for handling the processing /// </summary> /// <param name="Stream">A GamespyTcpStream object that wraps the I/O AsyncEventArgs and socket</param> protected override void ProcessAccept(GamespyTcpStream Stream) { try { // Convert the TcpClient to a MasterClient GpspClient client = new GpspClient(Stream); Clients.TryAdd(client.ConnectionId, client); // Begin accepting data now that we are fully connected Stream.BeginReceive(); } catch (Exception e) { L.LogError("WARNING: An Error occured at [Gpsp.ProcessAccept] : Generating Exception Log"); ExceptionHandler.GenerateExceptionLog(e); base.Release(Stream); } }
/// <summary> /// Callback for when a connection had disconnected /// </summary> /// <param name="sender">The client object whom is disconnecting</param> private void GpspClient_OnDisconnect(GpspClient client) { // Release this stream's AsyncEventArgs to the object pool base.Release(client.Stream); if (Clients.TryRemove(client.ConnectionId, out client) && !client.Disposed) client.Dispose(); }
/// <summary> /// Callback for when a connection had disconnected /// </summary> /// <param name="sender">The client object whom is disconnecting</param> private void GpspClient_OnDisconnect(GpspClient client) { Clients.Remove(client); }