Ejemplo n.º 1
0
        /// <summary>
        /// Fired when client fails to join game
        /// </summary>
        /// <param name="sender">DriverClient that caused this event</param>
        /// <param name="e">Failure information</param>
        void newClient_OnFailure(object sender, FailureArgs e)
        {
            ClientDriver source = sender as ClientDriver;

            FailedClientCounts[source.ClientIndex]++;

            if (FailedClientCounts[source.ClientIndex] <= 3)
            {
                if (!RecycleClient(source))
                {
                    return;
                }

                Output("Client failure #" + FailedClientCounts[source.ClientIndex]);
            }
            else
            {
                Output("Client failed too many times, ignoring it from now on");
            }

            if (e.Type == FailureArgs.FailureTypes.GameserverDeniedConnection)
            {
                TemporaryJoinDelay += 5000;
                Output("Adding a 5second temporary join delay");
            }
            else if (e.Type == FailureArgs.FailureTypes.FailedToJoinGame)
            {
                Output("Failed to join game, giving up");
                return;
            }

            Output("Attempting next client");
            PushBot();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles failure and disconnects.
        /// </summary>
        /// <param name="failureType">Type of the failure.</param>
        /// <param name="message">The error message.</param>
        internal void Fail(FailureArgs.FailureTypes failureType, string message)
        {
            LogError(message);

            if (HasFailed)
            {
                failureArgs.Message += ". " + message;
            }
            else
            {
                failureArgs = new FailureArgs(failureType, message);
            }

            HasFailed       = true;
            IsDisconnecting = true;
            Disconnect();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Fired when client fails when communicating with the game server
 /// </summary>
 /// <param name="sender">Object causing this event</param>
 /// <param name="e">Details of the failure</param>
 private void gameServer_OnFailure(object sender, FailureArgs e)
 {
     Log("GameServer failed -> " + e.ToString());
     FireOnFailureEvent(e.Type, e.Message);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Asynchronously raises the on failure event. 
 /// </summary>
 /// <param name="failureTypes">Type of failures.</param>
 /// <param name="message">The error message.</param>
 private void FireOnFailureEvent(FailureArgs.FailureTypes failureTypes, string message)
 {
     EventHandler<FailureArgs> tempHandler = OnFailure;
     if (tempHandler != null)
     {
         tempHandler.BeginInvoke(this, new FailureArgs(failureTypes, message), null, null);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Handles failure and disconnects.
        /// </summary>
        /// <param name="failureType">Type of the failure.</param>
        /// <param name="message">The error message.</param>
        internal void Fail(FailureArgs.FailureTypes failureType, string message)
        {
            LogError(message);

            if (HasFailed)
            {
                failureArgs.Message += ". " + message;
            }
            else
            {
                failureArgs = new FailureArgs(failureType, message);
            }

            HasFailed = true;
            IsDisconnecting = true;
            Disconnect();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Fired when client fails when communicating with the realm server
 /// </summary>
 /// <param name="sender">Object causing this event</param>
 /// <param name="e">Details of the failure</param>
 private void realmServer_OnFailure(object sender, FailureArgs e)
 {
     Log("RealmServer failed -> " + e.ToString());
     FireOnFailureEvent(e.Type, e.Message);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Fired when client fails to join game
        /// </summary>
        /// <param name="sender">DriverClient that caused this event</param>
        /// <param name="e">Failure information</param>
        void newClient_OnFailure(object sender, FailureArgs e)
        {
            ClientDriver source = sender as ClientDriver;
            FailedClientCounts[source.ClientIndex]++;

            if (FailedClientCounts[source.ClientIndex] <= 3)
            {
                if (!RecycleClient(source))
                {
                    return;
                }

                Output("Client failure #" + FailedClientCounts[source.ClientIndex]);
            }
            else
            {
                Output("Client failed too many times, ignoring it from now on");
            }

            if (e.Type == FailureArgs.FailureTypes.GameserverDeniedConnection)
            {
                TemporaryJoinDelay += 5000;
                Output("Adding a 5second temporary join delay");
            }
            else if (e.Type == FailureArgs.FailureTypes.FailedToJoinGame)
            {
                Output("Failed to join game, giving up");
                return;
            }

            Output("Attempting next client");
            PushBot();
        }