Пример #1
0
 internal async void OnDisconnected(SteamClient.DisconnectedCallback callback)
 {
     if (needAuthCode || needTwoFactorAuthCode)
     {
         return;
     }
     if (Restarting)
     {
         Restarting = false;
         Thread.Sleep(5000);
         Start().Forget();
         return;
     }
     Log("Disconnected from steam.", LogType.Info);
     if (!isManualDisconnect)
     {
         Log("Reconnecting to steam", LogType.Info);
         Thread.Sleep(5000);
         Start().Forget();
         return;
     }
     isRunning   = false;
     initialized = true;
     Status      = StatusEnum.Disabled;
 }
Пример #2
0
        private void OnDisconnect(SteamClient.DisconnectedCallback callback)
        {
            Console.WriteLine("Disconnected! Reconnecting...");

            Thread.Sleep(TimeSpan.FromSeconds(5));
            _steamNerd.SteamClient.Connect();
        }
Пример #3
0
        public override void OnDisconnected(SteamClient.DisconnectedCallback callback)
        {
            _reconnects++;

            if (_reconnects <= 5 && (Result != Result.Success ||
                                     Result != Result.AlreadyLoggedInSomewhereElse || IsRunning))
            {
                _log.Information("Disconnected from Steam. Retrying in 5 seconds... ({Count}/5)", _reconnects);

                Thread.Sleep(TimeSpan.FromSeconds(5));

                _log.Debug(">>> Connecting to Steam using Steam Client.");

                _steamClient.Connect();

                _log.Debug(">>> Success.");
            }
            else
            {
                _log.Debug(">>> Forcefully disconnected from Steam. {Result} / {Reconnects} / {IsRunning}",
                           Result, _reconnects, IsRunning);
                _log.Debug("Successfully disconnected from Steam.");
                IsRunning = false;
            }
        }
Пример #4
0
        private void DisconnectedCallback(SteamClient.DisconnectedCallback disconnected)
        {
            bDidDisconnect = true;

            if (disconnected.UserInitiated || bExpectingDisconnectRemote)
            {
                Log.Info("Disconnected from Steam");
            }
            else if (connectionBackoff >= 10)
            {
                Log.Info("Could not connect to Steam after 10 tries");
                Abort(false);
            }
            else if (!bAborted)
            {
                if (bConnecting)
                {
                    Log.Info("Connection to Steam failed. Trying again");
                }
                else
                {
                    Log.Info("Lost connection to Steam. Reconnecting");
                }

                Thread.Sleep(1000 * ++connectionBackoff);
                steamClient.Connect();
            }
        }
Пример #5
0
        private void OnDisconnected(SteamClient.DisconnectedCallback callback)
        {
            if (IsDisconnecting)
            {
                return;
            }

            var now = DateTime.Now;

            if (LastSuccess + NoSuccessRemoval < now && LastSeen + NoSuccessRemoval < now)
            {
                IsDisconnecting = true;
                Task.Run(() => SteamManager.Instance.RemoveCM(this));
                return;
            }

            var numSeconds = SteamManager.Instance.Random.Next(10, 30);

            Connect(now + TimeSpan.FromSeconds(numSeconds));

            // If Steam dies, don't say next connect is planned
            if (Reconnecting == 0)
            {
                Reconnecting = 2;
            }

            SteamManager.Instance.NotifyCMOffline(this, Reconnecting == 1 ? EResult.OK : EResult.NoConnection, $"Disconnected (#{Reconnecting})");
        }
Пример #6
0
        static void OnDisconnected(SteamClient.DisconnectedCallback callback)
        {
            Console.WriteLine("\n[i] {0} is reconnecting to Steam!\n[i] This is normal!", user);
            Thread.Sleep(TimeSpan.FromSeconds(5));

            steamClient.Connect();
        }
Пример #7
0
 private async void OnDisconnected(SteamClient.DisconnectedCallback callback)
 {
     _cts !.Cancel();
     _logger.LogWarning("Disconnected. Re-establishing connection..");
     _cts.Dispose();
     await StartAsync(CancellationToken.None);
 }
Пример #8
0
        /// <summary>
        /// OnDisconnected Callback
        /// Fires when Client disconnects from Steam
        /// Will also fire when setting up an account to re-auth
        /// </summary>
        /// <param name="callback"></param>
        private void OnDisconnected(SteamClient.DisconnectedCallback callback)
        {
            /*Only want to count a disconnect if the bot was disconnected*/
            /*while it was fully logged in*/
            if (mBotState == BotState.LoggedIn)
            {
                mDisconnectedCounter++;
            }

            mBotState = BotState.LoggedOut;
            if (mIsRunning)
            {
                if (mDisconnectedCounter <= 3)
                {
                    Print("Reconnecting in 5s...");
                    Thread.Sleep(5000);
                }
                else
                {
                    Print("Too many disconnects in a short period of time. Sleeping for 20 minutes.");
                    Thread.Sleep(TimeSpan.FromMinutes(20));
                    mDisconnectedCounter = 0;
                }

                Connect();
            }
        }
Пример #9
0
        public override void OnDisconnected(SteamClient.DisconnectedCallback callback)
        {
            _reconnects++;

            if (_reconnects <= 5 && !callback.UserInitiated && IsRunning)
            {
                // TODO: Fix reconnecting, see GH issue
                _log.Information("Disconnected from Steam. Retrying in 2 seconds... ({Count}/5)", _reconnects);
                //_log.Debug("Steam: {@steam} - Account: {@this}", _steamClient, this);

                Thread.Sleep(TimeSpan.FromSeconds(2));

                var worker = new BackgroundWorker();
                worker.DoWork += (sender, args) =>
                {
                    //_log.Debug("Starting watchdog.");
                    Thread.Sleep(TimeSpan.FromSeconds(10));

                    //_log.Debug("Steam Client connected after 10 sec: {bool}", _steamClient.IsConnected);
                    //_log.Debug("Steam: {@steam} - Account: {@this}", _steamClient, this);
                };
                worker.RunWorkerAsync();

                _log.Debug("Reconnecting to Steam.", worker);
                _steamClient.Connect();
            }
            else
            {
                _log.Debug("Successfully disconnected from Steam.");
                IsRunning = false;
            }
        }
Пример #10
0
 static void OnDisconnected(SteamClient.DisconnectedCallback callback)
 {
     Console.WriteLine("Disconnected from Steam");
     steamClient.Connect();
     Console.WriteLine("Trying to reconnect");
     Console.ReadLine();
 }
Пример #11
0
        static void OnDisconnected(SteamClient.DisconnectedCallback callback)
        {
            Console.WriteLine("\n{0} Disconnected From Steam, Reconnecting In 5 Seconds...\n", user);
            Thread.Sleep(TimeSpan.FromSeconds(5));

            steamClient.Connect();
        }
Пример #12
0
        private void DisconnectedCallback(SteamClient.DisconnectedCallback disconnected)
        {
            bDidDisconnect = true;

            if (disconnected.UserInitiated || bExpectingDisconnectRemote)
            {
                isLoggingIn = false;
                DebugLog.WriteLine("Steam3Session", "Disconnected from Steam");
                onDisconnected?.Invoke();
            }
            else if (connectionBackoff >= 3)
            {
                isLoggingIn = false;
                DebugLog.WriteLine("Steam3Session", "Could not connect to Steam after 3 tries");
                Abort(false);
                onDisconnected?.Invoke();
            }
            else if (!bAborted)
            {
                if (bConnecting)
                {
                    DebugLog.WriteLine("Steam3Session", "Connection to Steam failed. Trying again");
                }
                else
                {
                    DebugLog.WriteLine("Steam3Session", "Lost connection to Steam. Reconnecting");
                }

                Thread.Sleep(1000 * ++connectionBackoff);
                steamClient.Connect();
            }
        }
Пример #13
0
        private void OnDisconnected(SteamClient.DisconnectedCallback callback)
        {
            if (!Steam.Instance.IsRunning)
            {
                Application.ChangelistTimer.Stop();

                Log.WriteInfo("Steam", "Disconnected from Steam");

                return;
            }

            if (Application.ChangelistTimer.Enabled)
            {
                IRC.Instance.SendMain("Disconnected from Steam. See{0} https://steamstat.us", Colors.DARKBLUE);
            }

            Application.ChangelistTimer.Stop();

            GameCoordinator.UpdateStatus(0, EResult.NoConnection.ToString());

            JobManager.CancelChatJobsIfAny();

            Log.WriteInfo("Steam", "Disconnected from Steam. Retrying in {0} seconds...", RETRY_DELAY);

            IRC.Instance.SendEmoteAnnounce("disconnected from Steam. Retrying in {0} seconds…", RETRY_DELAY);

            ReconnectionTimer.Start();
        }
Пример #14
0
        static void OnDisconnected(SteamClient.DisconnectedCallback callback)

        {
            Console.WriteLine("\n{0} почему-то отключаюсь от Steam, ща переподключусь... \n", user);
            Thread.Sleep(TimeSpan.FromSeconds(5));

            steamClient.Connect();
        }
Пример #15
0
        static void onDisconnected(SteamClient.DisconnectedCallback callback)
        {
            Console.WriteLine("Disconnected from Steam, reconnecting in 5...");

            Thread.Sleep(TimeSpan.FromSeconds(5));

            steamClient.Connect();
        }
Пример #16
0
 private static void OnDisconnected(SteamClient.DisconnectedCallback callback)
 {
     Log.Instance.Warn("Disconnected from Steam, reconnecting in 5 seconds...");
     System.Timers.Timer t = new System.Timers.Timer(5000);
     t.Elapsed  += T_Elapsed;
     t.AutoReset = false;
     t.Start();
 }
Пример #17
0
 //Now we create an OnDisconnected function to have the bot attempt to reconnect
 static void OnDisconnected(SteamClient.DisconnectedCallback callback)
 {
     //Inform the user that the bot was disconnected and is now attempting to reconnect
     Console.WriteLine("\n{0} disconnected from Steam, reconnecting in 5...\n", user);
     //Sleep the program for 5 seconds
     Thread.Sleep(TimeSpan.FromSeconds(5));
     //attempt to reconnect
     steamClient.Connect();
 }
Пример #18
0
 private void OnDisconnected(SteamClient.DisconnectedCallback callback)
 {
     //if we are shutting down - ok; if drop - throw
     if (_isRunning == SteamManagerStatus.Stopped || _exception != null)
     {
         return;
     }
     _exception = new ConnectionException("Disconnected from Steam");
 }
Пример #19
0
        static void OnDisconnected(SteamClient.DisconnectedCallback callback)
        {
            //Console.WriteLine("Disconnected from Steam, reconnecting in 5...");

            //Thread.Sleep(TimeSpan.FromSeconds(5));

            // steamClient.Connect();
            Environment.Exit(1);
        }
Пример #20
0
        private void onDisconnected(SteamClient.DisconnectedCallback callback)
        {
            log.Debug("Disconnection callback from Steam");

            if (State != BotState.Failed)
            {
                State = BotState.Disconnected;
            }
        }
Пример #21
0
        private void OnDisconnected(SteamClient.DisconnectedCallback obj)
        {
            if (obj.UserInitiated)
            {
                _logger?.LogInformation($"Disconnect requested by user.");
            }

            cts.Cancel();
        }
Пример #22
0
 private void OnDisconnected(SteamClient.DisconnectedCallback disconnectedCallback)
 {
     if (disconnectedCallback.UserInitiated)
     {
         return;
     }
     _logger.Warn($"#{SequenceNumber} Disconnected.");
     Restart();
 }
Пример #23
0
        private static void OnDisconnected(SteamClient.DisconnectedCallback obj)
        {
            if (obj.UserInitiated)
            {
                keepRunning = false;
                return;
            }

            client.Connect();
        }
Пример #24
0
        /// <summary>
        /// Perform action if we are disconnected from the Steamservers
        ///
        /// Retry to connect to the steamservers after 5 seconds
        /// </summary>
        /// <param name="_callback"></param>
        private void OnDisconnected(SteamClient.DisconnectedCallback _callback)
        {
            m_logger.Warning("Disconnected from Steam, try to connect again in 5 seconds!");

            m_cardFarmHelper.StopCheckFarmCards();

            Thread.Sleep(TimeSpan.FromSeconds(5));

            m_steamClient.Connect();
        }
Пример #25
0
 /// <summary>
 /// OnDisconnected Callback
 /// Fires when Client disconnects from Steam
 /// Will also fire when setting up an account to re-auth
 /// </summary>
 /// <param name="callback"></param>
 private void OnDisconnected(SteamClient.DisconnectedCallback callback)
 {
     mBotState = BotState.LoggedOut;
     if (mIsRunning)
     {
         Print("Reconnecting in 3s...");
         Thread.Sleep(3000);
         mSteam.client.Connect();
     }
 }
Пример #26
0
        public void OnSteambotDisconnected(SteamClient.DisconnectedCallback callback)
        {
            if (stop == false)
            {
                Console.WriteLine("Disconnected from Steam, reconnecting in 5 seconds...");
                Thread.Sleep(TimeSpan.FromSeconds(5));

                steamClient.Connect();
            }
        }
Пример #27
0
        private void OnDisconnected(SteamClient.DisconnectedCallback obj)
        {
            if (!obj.UserInitiated)
            {
                Logger.Log("Lost connection!");
            }

            LastActionTime = DateTime.Now;
            Client.Connect();
        }
Пример #28
0
        protected override void OnDisconnected(SteamClient.DisconnectedCallback callback)
        {
            base.OnDisconnected(callback);

            if (!IsDisconnecting)
            {
                // if we're not forcibly disconnecting this instance, notify that the CM is offline
                SteamManager.Instance.NotifyCMOffline(this);
            }
        }
Пример #29
0
 private void EventOnDisconnected(SteamClient.DisconnectedCallback callback)
 {
     _logger.Info("Disconnected from Steam");
     OnDisconnected?.Invoke();
     if (!_disconnectRequested)
     {
         Thread.Sleep(1000);
         Connect();
     }
 }
Пример #30
0
        private void DisconnectedCallback(SteamClient.DisconnectedCallback disconnected)
        {
            if ((!bConnected && !bConnecting) || bAborted)
            {
                return;
            }

            Console.WriteLine("Reconnecting");
            steamClient.Connect();
        }