void OnStreamError(object sender, StreamErrorEventArgs e)
        {
            dispatcher.Invoke(() =>
                {
                    bool handled = false;

                    if (e.Exception is IOException)
                    {
                        var socketEx = e.Exception.InnerException as SocketException;
                        if (socketEx != null)
                        {
                            switch (socketEx.SocketErrorCode)
                            {
                                case SocketError.Interrupted:
                                    handled = true;
                                    break;

                                case SocketError.ConnectionAborted:
                                case SocketError.ConnectionReset:
                                    if (!connection.Reconnect())
                                    {
                                        LogOut();
                                    }
                                    handled = true;
                                    break;
                            }
                        }
                    }

                    if (!handled)
                        throw e.Exception;
                });
        }
示例#2
0
 void OnStreamError(object sender, StreamErrorEventArgs e)
 {
     StreamError.SafeInvoke(this, e);
 }
示例#3
0
 void OnStreamError(object sender, StreamErrorEventArgs e)
 {
     StreamError.SafeInvoke(this, e);
 }