diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-01 14:24:27 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-01 14:24:27 -0400 |
| commit | 3d40c5ba36c5e98954c2bc6073b4cf35cd42711a (patch) | |
| tree | be7328c6d1d2193041c9b3dd00ff40fd0f825599 /MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | |
| parent | 900266eb54e3b13219eb21e6d22fb34ce28059ab (diff) | |
fixed xml providers running over and over
Diffstat (limited to 'MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index 550fe9593..3a626000f 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -220,10 +220,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager { options.ResourcePool.Release(); } - + throw new HttpException(string.Format("Connection to {0} timed out", options.Url)) { IsTimedOut = true }; } - + _logger.Info("HttpClientManager.Get url: {0}", options.Url); try @@ -512,10 +512,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager if (operationCanceledException != null) { // Cleanup - if (File.Exists(tempFile)) - { - File.Delete(tempFile); - } + DeleteTempFile(tempFile); return GetCancellationException(options.Url, options.CancellationToken, operationCanceledException); } @@ -525,10 +522,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager var httpRequestException = ex as HttpRequestException; // Cleanup - if (File.Exists(tempFile)) - { - File.Delete(tempFile); - } + DeleteTempFile(tempFile); if (httpRequestException != null) { @@ -538,6 +532,18 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager return ex; } + private void DeleteTempFile(string file) + { + try + { + File.Delete(file); + } + catch (IOException) + { + // Might not have been created at all. No need to worry. + } + } + /// <summary> /// Validates the params. /// </summary> |
