void Accept(IAsyncResult result)
        {
            if (Server.shuttingDown == false)
            {
                Remote p = null;
                bool begin = false;
                try
                {
                    p = new Remote();

                    p.socket = listen.EndAccept(result);
                    new Thread(new ThreadStart(p.Start)).Start();

                    listen.BeginAccept(new AsyncCallback(Accept), null);
                    begin = true;

                }
                catch (SocketException)
                {
                    if (p != null)
                        p.Disconnect();
                    if (!begin)
                        listen.BeginAccept(new AsyncCallback(Accept), null);
                }
                catch (Exception e)
                {
                    Server.s.Log(e.Message);
                    Server.s.Log(e.StackTrace);
                    if (p != null)
                        p.Disconnect();
                    if (!begin)
                        listen.BeginAccept(new AsyncCallback(Accept), null);
                }
            }
        }
Beispiel #2
0
        void Accept(IAsyncResult result)
        {
            if (Server.shuttingDown) return;
            Remote p = null;
            var begin = false;
            try
            {
                p = new Remote();

                if (tries < 7)
                {
                    if (tries < 5)
                    {
                        p.Socket = listen.EndAccept(result);
                        new Thread(p.Start).Start();

                        listen.BeginAccept(Accept, null);
                        begin = true;
                    }
                    else
                    {
                        new Thread(() =>
                                       {
                                           Thread.Sleep(0x927c0);  //10 mins
                                           Command.all.Find("remote").Use(null, "resettry");
                                       }).Start();
                    }
                }

            }
            catch (SocketException)
            {
                if (p != null)
                    p.Disconnect();
                if (begin) return;
                listen.BeginAccept(Accept, null);
            }
            catch (Exception e)
            {
                Server.s.Log(e.Message);
                Server.s.Log(e.StackTrace);
                if (p != null)
                    p.Disconnect();
                if (begin) return;
                listen.BeginAccept(Accept, null);
            }
        }
Beispiel #3
0
 public Remote()
 {
     Remote.This = this;
     key = generateRandChars();
 }
Beispiel #4
0
 public Remote()
 {
     Remote.This = this;
 }