BF2Statistics.Gamespy.GpcmServer.ProcessAccept C# (CSharp) Method

ProcessAccept() protected method

When a new connection is established, we the parent class are responsible for handling the processing
protected ProcessAccept ( GamespyTcpStream Stream ) : void
Stream GamespyTcpStream A GamespyTcpStream object that wraps the I/O AsyncEventArgs and socket
return void
        protected override void ProcessAccept(GamespyTcpStream Stream)
        {
            // Get our connection id
            int ConID = Interlocked.Increment(ref ConnectionCounter);
            GpcmClient client;

            try
            {
                // Create a new GpcmClient, passing the IO object for the TcpClientStream
                client = new GpcmClient(Stream, ConID);
                Processing.TryAdd(ConID, client);

                // Begin the asynchronous login process
                client.SendServerChallenge();
            }
            catch (Exception e)
            {
                // Log the error
                Program.ErrorLog.Write("WARNING: An Error occured at [GpcmServer.ProcessAccept] : Generating Exception Log");
                ExceptionHandler.GenerateExceptionLog(e);

                // Remove pending connection
                Processing.TryRemove(ConID, out client);

                // Release this stream so it can be used again
                base.Release(Stream);
            }
        }