aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
index 28fc094f7..1ca5f1204 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs
@@ -39,6 +39,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
public bool Throttle { get; set; }
public long ThrottleLimit { get; set; }
public long MinThrottlePosition;
+ public Func<long, long, long> ThrottleCallback { get; set; }
+ public Action OnComplete { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="StreamWriter" /> class.
@@ -85,7 +87,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{
responseStream = new ThrottledStream(responseStream, ThrottleLimit)
{
- MinThrottlePosition = MinThrottlePosition
+ MinThrottlePosition = MinThrottlePosition,
+ ThrottleCallback = ThrottleCallback
};
}
var task = WriteToAsync(responseStream);
@@ -113,6 +116,13 @@ namespace MediaBrowser.Server.Implementations.HttpServer
throw;
}
+ finally
+ {
+ if (OnComplete != null)
+ {
+ OnComplete();
+ }
+ }
}
}
}