private void ThrowIfNotOpen() { try { if (Logging.IsEnabled) { Logging.Enter(this, $"{nameof(LegacyClientWebSocketTransport)}.{nameof(ThrowIfNotOpen)}"); } IotHubClientWebSocket.WebSocketState webSocketState = _webSocket.State; if (webSocketState == IotHubClientWebSocket.WebSocketState.Open) { return; } if (webSocketState == IotHubClientWebSocket.WebSocketState.Aborted || webSocketState == IotHubClientWebSocket.WebSocketState.Closed) { throw new ObjectDisposedException(GetType().Name); } throw new AmqpException(AmqpErrorCode.IllegalState, null); } finally { if (Logging.IsEnabled) { Logging.Exit(this, $"{nameof(LegacyClientWebSocketTransport)}.{nameof(ThrowIfNotOpen)}"); } } }
protected override bool CloseInternal() { try { if (Logging.IsEnabled) { Logging.Enter(this, $"{nameof(LegacyClientWebSocketTransport)}.{nameof(CloseInternal)}"); } IotHubClientWebSocket.WebSocketState webSocketState = _webSocket.State; if (webSocketState != IotHubClientWebSocket.WebSocketState.Closed && webSocketState != IotHubClientWebSocket.WebSocketState.Aborted) { CloseInternalAsync().GetAwaiter().GetResult(); } return(true); } finally { if (Logging.IsEnabled) { Logging.Exit(this, $"{nameof(LegacyClientWebSocketTransport)}.{nameof(CloseInternal)}"); } } }
protected override bool CloseInternal() { IotHubClientWebSocket.WebSocketState webSocketState = _webSocket.State; if (webSocketState != IotHubClientWebSocket.WebSocketState.Closed && webSocketState != IotHubClientWebSocket.WebSocketState.Aborted) { CloseInternalAsync().Fork(); } return(true); }
private void ThrowIfNotOpen() { IotHubClientWebSocket.WebSocketState webSocketState = _webSocket.State; if (webSocketState == IotHubClientWebSocket.WebSocketState.Open) { return; } if (webSocketState == IotHubClientWebSocket.WebSocketState.Aborted || webSocketState == IotHubClientWebSocket.WebSocketState.Closed) { throw new ObjectDisposedException(GetType().Name); } throw new AmqpException(AmqpErrorCode.IllegalState, null); }