aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations/HttpClientManager
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Common.Implementations/HttpClientManager')
-rw-r--r--MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs26
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>