diff options
| author | Bond-009 <bond.009@outlook.com> | 2025-01-28 11:29:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-28 11:29:46 +0100 |
| commit | 973489232205755abe16762c1e3446f2236349f2 (patch) | |
| tree | a5777cf5c4718bd3f9e75670e34cfef77e64243b /Emby.Server.Implementations/HttpServer/WebSocketConnection.cs | |
| parent | bcdffa74a80972f8493837fa911c9628598f7fa3 (diff) | |
| parent | d2db7004024c6bbdd541a381c673f1e0b0aebfcb (diff) | |
Merge pull request #12925 from Bond-009/await
Always await instead of directly returning Task
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/WebSocketConnection.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/WebSocketConnection.cs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs index cb6f7e1d3..a720c86fb 100644 --- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs +++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs @@ -82,17 +82,17 @@ namespace Emby.Server.Implementations.HttpServer public WebSocketState State => _socket.State; /// <inheritdoc /> - public Task SendAsync(OutboundWebSocketMessage message, CancellationToken cancellationToken) + public async Task SendAsync(OutboundWebSocketMessage message, CancellationToken cancellationToken) { var json = JsonSerializer.SerializeToUtf8Bytes(message, _jsonOptions); - return _socket.SendAsync(json, WebSocketMessageType.Text, true, cancellationToken); + await _socket.SendAsync(json, WebSocketMessageType.Text, true, cancellationToken).ConfigureAwait(false); } /// <inheritdoc /> - public Task SendAsync<T>(OutboundWebSocketMessage<T> message, CancellationToken cancellationToken) + public async Task SendAsync<T>(OutboundWebSocketMessage<T> message, CancellationToken cancellationToken) { var json = JsonSerializer.SerializeToUtf8Bytes(message, _jsonOptions); - return _socket.SendAsync(json, WebSocketMessageType.Text, true, cancellationToken); + await _socket.SendAsync(json, WebSocketMessageType.Text, true, cancellationToken).ConfigureAwait(false); } /// <inheritdoc /> @@ -224,12 +224,12 @@ namespace Emby.Server.Implementations.HttpServer return ret; } - private Task SendKeepAliveResponse() + private async Task SendKeepAliveResponse() { LastKeepAliveDate = DateTime.UtcNow; - return SendAsync( + await SendAsync( new OutboundKeepAliveMessage(), - CancellationToken.None); + CancellationToken.None).ConfigureAwait(false); } /// <inheritdoc /> |
