Ejemplo n.º 1
0
        private void TsFullClient_OnErrorEvent(object sender, CommandError e)
        {
            switch (e.Id)
            {
            case Ts3ErrorCode.whisper_no_targets:
                stallNoErrorCount = 0;
                isStall           = true;
                break;

            case Ts3ErrorCode.client_could_not_validate_identity:
                if (ts3FullClientData.IdentityLevel == "auto")
                {
                    int targetSecLevel = int.Parse(e.ExtraMessage);
                    Log.Write(Log.Level.Info, "Calculating up to required security level: {0}", targetSecLevel);
                    Ts3Crypt.ImproveSecurity(identity, targetSecLevel);
                    ts3FullClientData.IdentityOffset = identity.ValidKeyOffset;

                    ConnectClient();
                }
                else
                {
                    Log.Write(Log.Level.Warning, "The server reported that the security level you set is not high enough." +
                              "Increase the value to \"{0}\" or set it to \"auto\" to generate it on demand when connecting.", e.ExtraMessage);
                }
                break;

            default:
                Log.Write(Log.Level.Debug, e.ErrorFormat());
                break;
            }
        }
Ejemplo n.º 2
0
 private static void Client_OnErrorEvent(object sender, CommandError e)
 {
     //var client = (Ts3FullClient)sender;
     Console.WriteLine(e.ErrorFormat());
     //if (!client.Connected)
     //{
     //	client.Connect(con);
     //}
 }
        private static void OnErrorEvent(object sender, CommandError e)
        {
            var client = (Ts3FullClient)sender;

            Console.WriteLine(e.ErrorFormat());
            if (!client.Connected)
            {
                Console.WriteLine("Could not connect: " + e.Message + " (" + e.ExtraMessage);
            }
        }
Ejemplo n.º 4
0
        private void Client_OnErrorEvent(object sender, CommandError e)
        {
            var client = (Ts3FullClient)sender;

            Console.WriteLine(e.ErrorFormat());
            if (!client.Connected)
            {
                client.Connect(con);
            }
        }
Ejemplo n.º 5
0
        private void ChangeState(ConnectionContext ctx, TsClientStatus setStatus, CommandError?error = null)
        {
            scheduler.VerifyOwnThread();

            if (ctx != context)
            {
                Log.Debug("Stray disconnect from old packethandler");
            }

            Log.Debug("ChangeState {0} -> {1} (error:{2})", status, setStatus, error?.ErrorFormat() ?? "none");

            switch ((status, setStatus))
            {
            case (TsClientStatus.Disconnected, TsClientStatus.Disconnected):
                // Already disconnected, do nothing
                break;

            case (TsClientStatus.Disconnected, TsClientStatus.Connecting):
                status = TsClientStatus.Connecting;
                break;

            case (TsClientStatus.Connecting, TsClientStatus.Connected):
                status = TsClientStatus.Connected;
                ctx.ConnectEvent.SetResult(R.Ok);
                break;

            case (TsClientStatus.Connecting, TsClientStatus.Disconnected):
            case (TsClientStatus.Connected, TsClientStatus.Disconnected):
            case (TsClientStatus.Disconnecting, TsClientStatus.Disconnected):
                status = TsClientStatus.Disconnected;
                ctx.PacketHandler.Stop();
                msgProc.DropQueue();

                var statusBefore = status;
                context = null;
                if (statusBefore == TsClientStatus.Connecting)
                {
                    ctx.ConnectEvent.SetResult(error ?? CommandError.ConnectionClosed);                     // TODO: Set exception maybe ?
                }
                ctx.DisconnectEvent.SetResult(null);
                OnDisconnected?.Invoke(this, new DisconnectEventArgs(ctx.ExitReason ?? Reason.LeftServer, error));
                break;

            case (TsClientStatus.Connected, TsClientStatus.Disconnecting):
                status = TsClientStatus.Disconnecting;
                break;

            default:
                Trace.Fail($"Invalid transition change from {status} to {setStatus}");
                break;
            }
        }
Ejemplo n.º 6
0
        private void TsFullClient_OnErrorEvent(object sender, CommandError error)
        {
            switch (error.Id)
            {
            case Ts3ErrorCode.whisper_no_targets:
                stallCheckPipe.SetStall();
                break;

            default:
                Log.Debug("Got ts3 error event: {0}", error.ErrorFormat());
                break;
            }
        }
Ejemplo n.º 7
0
        private void TsFullClient_OnErrorEvent(object sender, CommandError e)
        {
            switch (e.Id)
            {
            case Ts3ErrorCode.whisper_no_targets:
                stallNoErrorCount = 0;
                isStall           = true;
                break;

            case Ts3ErrorCode.client_could_not_validate_identity:
                autoReconnectOnce = true;
                int targetSecLevel = int.Parse(e.ExtraMessage);
                Log.Write(Log.Level.Info, "Calculating up to required security level: {0}", targetSecLevel);
                Ts3Crypt.ImproveSecurity(identity, targetSecLevel);
                ts3FullClientData.IdentityOffset = identity.ValidKeyOffset;

                tsFullClient.Disconnect();
                break;

            default:
                Log.Write(Log.Level.Debug, e.ErrorFormat());
                break;
            }
        }
Ejemplo n.º 8
0
        private void DisconnectInternal(ConnectionContext ctx, CommandError error = null, Ts3ClientStatus?setStatus = null)
        {
            bool triggerEventSafe = false;

            lock (statusLock)
            {
                Log.Debug("DisconnectInternal wasExit:{0} error:{1} oldStatus:{2} newStatus:{3}", ctx.WasExit, error?.ErrorFormat(), status, setStatus);

                if (setStatus.HasValue)
                {
                    status = setStatus.Value;
                }

                if (ctx.WasExit)
                {
                    return;
                }

                switch (status)
                {
                case Ts3ClientStatus.Connecting:
                case Ts3ClientStatus.Disconnected:
                    ctx.WasExit = true;
                    packetHandler.Stop();
                    msgProc.DropQueue();
                    dispatcher.Dispose();
                    triggerEventSafe = true;
                    break;

                case Ts3ClientStatus.Disconnecting:
                    break;

                case Ts3ClientStatus.Connected:
                    ClientDisconnect(Reason.LeftServer, QuitMessage);
                    status = Ts3ClientStatus.Disconnecting;
                    break;

                default:
                    throw Util.UnhandledDefault(status);
                }
            }

            if (triggerEventSafe)
            {
                OnDisconnected?.Invoke(this, new DisconnectEventArgs(packetHandler.ExitReason ?? Reason.LeftServer, error));
            }
        }
Ejemplo n.º 9
0
 internal Ts3CommandException(CommandError message, Exception inner) : base(message.ErrorFormat(), inner)
 {
     ErrorStatus = message;
 }
Ejemplo n.º 10
0
 internal Ts3CommandException(CommandError message) : base(message.ErrorFormat())
 {
     ErrorStatus = message;
 }
Ejemplo n.º 11
0
 private static void Client_OnErrorEvent(object sender, CommandError e)
 {
     ConsoleHelper.WriteEventLine(e.ErrorFormat(), Color.ForestGreen);
 }