Ejemplo n.º 1
0
        private void Adapter_OnError(object sender, ProtocolAdapterErrorEventArgs args)
        {
            //Trace.TraceError("{0} - Protocol Adapter on channel {1} threw error {2}", DateTime.UtcNow.ToString("yyyy-MM-ddTHH-MM-ss.fffff"), args.ChannelId, args.Error.Message);
            Console.WriteLine("{0} - Adpater exception - {1}", DateTime.UtcNow.ToString("yyyy-MM-ddTHH-MM-ss.fffff"), args.Error.Message);

            Exception inner = args.Error.InnerException;

            while (inner != null)
            {
                Console.WriteLine("{0} - Adapter Exception Inner - {1}", DateTime.UtcNow.ToString("yyyy-MM-ddTHH-MM-ss.fffff"), inner.Message);
                inner = inner.InnerException;
            }

            //Trace.WriteLine("------ Stack Trace -------");
            //Trace.TraceError(args.Error.StackTrace);
            //Trace.WriteLine("------ End Stack Trace -------");

            try
            {
                if (dict.ContainsKey(args.ChannelId))
                {
                    ProtocolAdapter adapter = dict[args.ChannelId];
                    dict.Remove(args.ChannelId);
                    adapter.Dispose();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("{0} - Exception disposing adapter Listener_OnError - {1}", DateTime.UtcNow.ToString("yyyy-MM-ddTHH-MM-ss.fffff"), ex.Message);
                //Trace.TraceWarning("{0} - TCP Listener exception disposing adapter Listener_OnError", DateTime.UtcNow.ToString("yyyy-MM-ddTHH-MM-ss.fffff"));
                //Trace.TraceError("{0} - Adapter dispose exception Listener_OnError - '{1}'", DateTime.UtcNow.ToString("yyyy-MM-ddTHH-MM-ss.fffff"),ex.Message);
                //Trace.TraceError("{0} - Adapter dispose stack trace Listener_OnError - {1}", DateTime.UtcNow.ToString("yyyy-MM-ddTHH-MM-ss.fffff"), ex.StackTrace);
            }
        }
Ejemplo n.º 2
0
 private void Adapter_OnError(object sender, ProtocolAdapterErrorEventArgs e)
 {
     try
     {
         adapter.Channel.CloseAsync().GetAwaiter();
     }
     catch { }
 }
Ejemplo n.º 3
0
 private void Adapter_OnError(object sender, ProtocolAdapterErrorEventArgs e)
 {
     Console.WriteLine($"Adapter OnError - {e.Error.Message}");
     if (container.ContainsKey(e.ChannelId))
     {
         ProtocolAdapter adapter = container[e.ChannelId];
         adapter.Channel.CloseAsync().GetAwaiter();
         Console.WriteLine("Adapter channel closed due to error.");
     }
 }
Ejemplo n.º 4
0
        private void Adapter_OnError(object sender, ProtocolAdapterErrorEventArgs e)
        {
            try
            {
                adapter.Channel.CloseAsync().GetAwaiter();
                logger.LogDebugAsync("Web socket adapter disposed.").GetAwaiter();
            }
            catch { }

            logger.LogErrorAsync(e.Error, "Web socket adapter error.").GetAwaiter();
        }
Ejemplo n.º 5
0
        private void Adapter_OnError(object sender, ProtocolAdapterErrorEventArgs e)
        {
            logger.LogErrorAsync(e.Error, "Adapter OnError").GetAwaiter();

            if (container.ContainsKey(e.ChannelId))
            {
                ProtocolAdapter adapter = container[e.ChannelId];
                adapter.Channel.CloseAsync().GetAwaiter();
                logger.LogWarningAsync("Adapter channel closed due to error.").GetAwaiter();
            }
        }
Ejemplo n.º 6
0
        private void Adapter_OnError(object sender, ProtocolAdapterErrorEventArgs e)
        {
            if (container.ContainsKey(e.ChannelId))
            {
                string key = container[e.ChannelId];
                if (cache.ContainsKey(key))
                {
                    Tuple <ProtocolAdapter, CancellationTokenSource> tuple = cache[key];
                    tuple.Item1.Dispose();
                    cache.Remove(key);
                }

                container.Remove(e.ChannelId);
            }
        }
Ejemplo n.º 7
0
        private async void Adapter_OnError(object sender, ProtocolAdapterErrorEventArgs args)
        {
            await logger.LogErrorAsync(args.Error, "Adapter exception.");

            try
            {
                if (dict.ContainsKey(args.ChannelId))
                {
                    ProtocolAdapter adapter = dict[args.ChannelId];
                    dict.Remove(args.ChannelId);
                    adapter.Dispose();
                }
            }
            catch (Exception ex)
            {
                await logger.LogErrorAsync(ex, "Adapter disposing");
            }
        }
Ejemplo n.º 8
0
 private void Adapter_OnError(object sender, ProtocolAdapterErrorEventArgs e)
 {
     Cleanup(e.ChannelId);
 }
Ejemplo n.º 9
0
 private void Adapter_OnError(object sender, ProtocolAdapterErrorEventArgs e)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 10
0
 private void Adapter_OnError(object sender, ProtocolAdapterErrorEventArgs e)
 {
     //write the error
     adapter.Channel.CloseAsync().GetAwaiter();
 }
Ejemplo n.º 11
0
 private void Adapter_OnError(object sender, ProtocolAdapterErrorEventArgs e)
 {
     Exception ex = e.Error;
 }