예제 #1
0
        public static void HandleIncomingConnection(Socket IncomingSocket)
        {
            bool flag;

            Output.WriteLine(((flag = ModerationBanManager.IsRemoteAddressBlacklisted(IncomingSocket.RemoteEndPoint.ToString().Split(new char[] { ':' })[0])) ? "Rejected" : "Accepted") + " incoming connection from " + IncomingSocket.RemoteEndPoint.ToString() + ".", OutputLevel.Informational);
            if (!flag && !RejectIncomingConnections)
            {
                lock (object_0)
                {
                    uint key = uint_0++;
                    concurrentDictionary_0.TryAdd(key, new Session(key, IncomingSocket));
                }
            }
            else
            {
                try
                {
                    IncomingSocket.Close();
                }
                catch (Exception)
                {
                }
            }
        }
예제 #2
0
        public static void HandleIncomingConnection(Socket IncomingSocket)
        {
            bool Reject = ModerationBanManager.IsRemoteAddressBlacklisted(IncomingSocket.RemoteEndPoint.ToString().Split(':')[0]);

            Output.WriteLine((Reject ? "Rejected" : "Accepted") + " incoming connection from " + IncomingSocket.RemoteEndPoint.ToString().Split(':')[0] + ".",
                             OutputLevel.Informational);

            if (Reject)
            {
                try
                {
                    IncomingSocket.Close();
                }
                catch (Exception) { }

                return;
            }

            lock (mSyncRoot)
            {
                uint Id = mCounter++;
                mSessions.Add(Id, new Session(Id, IncomingSocket));
            }
        }