aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2022-08-22 19:20:28 +0200
committerGitHub <noreply@github.com>2022-08-22 19:20:28 +0200
commit10484033f8b3c27b44c7f966a8c67f4f33a1822d (patch)
tree62a8f022ef696ce60462efc2717932eda35078ea
parent33611614ed3362bd6b9b83781a47927fc16bba5a (diff)
parent7d48f97db9f6a5809a785417b834d47aa1cde896 (diff)
Merge pull request #8300 from Bond-009/dlnaregression
-rw-r--r--Emby.Dlna/PlayTo/DlnaHttpClient.cs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Emby.Dlna/PlayTo/DlnaHttpClient.cs b/Emby.Dlna/PlayTo/DlnaHttpClient.cs
index 62156d183..75ff542dd 100644
--- a/Emby.Dlna/PlayTo/DlnaHttpClient.cs
+++ b/Emby.Dlna/PlayTo/DlnaHttpClient.cs
@@ -66,13 +66,15 @@ namespace Emby.Dlna.PlayTo
}
}
- public Task<XDocument?> GetDataAsync(string url, CancellationToken cancellationToken)
+ public async Task<XDocument?> GetDataAsync(string url, CancellationToken cancellationToken)
{
using var request = new HttpRequestMessage(HttpMethod.Get, url);
- return SendRequestAsync(request, cancellationToken);
+
+ // Have to await here instead of returning the Task directly, otherwise request would be disposed too soon
+ return await SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
}
- public Task<XDocument?> SendCommandAsync(
+ public async Task<XDocument?> SendCommandAsync(
string baseUrl,
DeviceService service,
string command,
@@ -99,7 +101,8 @@ namespace Emby.Dlna.PlayTo
request.Headers.TryAddWithoutValidation("contentFeatures.dlna.org", header);
}
- return SendRequestAsync(request, cancellationToken);
+ // Have to await here instead of returning the Task directly, otherwise request would be disposed too soon
+ return await SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
}
}
}