Ejemplo n.º 1
0
        public static void Switch(GStatsClient client, Dictionary <string, string> recv)
        {
            string command = recv.Keys.First();

            try
            {
                switch (command)
                {
                case "auth":
                    AuthHandler.SendSessionKey(client, recv);
                    break;

                case "authp":
                    AuthpHandler.AuthPlayer(client, recv);
                    break;

                default:
                    LogWriter.Log.Write("[GSTAS] received unknown data " + command, LogLevel.Debug);
                    break;
                }
            }
            catch (Exception e)
            {
                LogWriter.Log.WriteException(e);
            }
        }
Ejemplo n.º 2
0
        /// <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(TCPStream stream)
        {
            // Get our connection id
            long         conid = Interlocked.Increment(ref ConnectionCounter);
            GStatsClient client;

            try
            {
                // Convert the TcpClient to a MasterClient
                client = new GStatsClient(stream, conid);
                Clients.TryAdd(conid, client);
                client.SendServerChallenge();
                // Start receiving data
                stream.BeginReceive();
            }
            catch
            {
                // Remove pending connection
                Clients.TryRemove(conid, out client);
            }
        }