public async Task DisconnectAsync(TimeSpan timeout, CancellationToken cancellationToken) { ThrowIfDisposed(); try { if (timeout == TimeSpan.Zero) { await _channel.DisconnectAsync(cancellationToken).ConfigureAwait(false); } else { await MqttTaskTimeout.WaitAsync( t => _channel.DisconnectAsync(t), timeout, cancellationToken).ConfigureAwait(false); } } catch (Exception exception) { if (IsWrappedException(exception)) { throw; } WrapException(exception); } }
public Task DisconnectAsync(TimeSpan timeout) { ThrowIfDisposed(); _logger.Verbose <MqttChannelAdapter>("Disconnecting [Timeout={0}]", timeout); return(ExecuteAndWrapExceptionAsync(() => _channel.DisconnectAsync().TimeoutAfter(timeout))); }
public async Task DisconnectAsync(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); try { await _channel.DisconnectAsync(cancellationToken).ConfigureAwait(false); } catch (Exception exception) { if (!WrapAndThrowException(exception)) { throw; } } }
public async Task DisconnectAsync(TimeSpan timeout, CancellationToken cancellationToken) { ThrowIfDisposed(); try { _logger.Verbose("Disconnecting [Timeout={0}]", timeout); await Common.TaskExtensions .TimeoutAfterAsync(ct => _channel.DisconnectAsync(), timeout, cancellationToken) .ConfigureAwait(false); } catch (Exception exception) { if (IsWrappedException(exception)) { throw; } WrapException(exception); } }
public async Task DisconnectAsync(TimeSpan timeout) { _logger.Info <MqttChannelAdapter>("Disconnecting [Timeout={0}]", timeout); await ExecuteAndWrapExceptionAsync(() => _channel.DisconnectAsync().TimeoutAfter(timeout)); }