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; }); }
void OnStreamError(object sender, StreamErrorEventArgs e) { StreamError.SafeInvoke(this, e); }