From 060215143ff62e4cf475a493e57c8607beca8640 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 20 Oct 2017 12:16:56 -0400 Subject: improve httpclient resource disposal --- .../Updates/InstallationManager.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'Emby.Server.Implementations/Updates') diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index 772f2338a..51acfee88 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -175,13 +175,24 @@ namespace Emby.Server.Implementations.Updates { "systemid", _applicationHost.SystemId } }; - using (var json = await _httpClient.Post("https://www.mb3admin.com/admin/service/package/retrieveall?includeAllRuntimes=true", data, cancellationToken).ConfigureAwait(false)) + var options = new HttpRequestOptions { - cancellationToken.ThrowIfCancellationRequested(); + Url = "https://www.mb3admin.com/admin/service/package/retrieveall?includeAllRuntimes=true", + CancellationToken = cancellationToken + }; + + options.SetPostData(data); + + using (var response = await _httpClient.SendAsync(options, "POST").ConfigureAwait(false)) + { + using (var json = response.Content) + { + cancellationToken.ThrowIfCancellationRequested(); - var packages = _jsonSerializer.DeserializeFromStream(json); + var packages = _jsonSerializer.DeserializeFromStream(json); - return FilterPackages(packages, packageType, applicationVersion); + return FilterPackages(packages, packageType, applicationVersion); + } } } else -- cgit v1.2.3