diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Session/WebSocketController.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Session/WebSocketController.cs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs index f51998fea..d4ecd9572 100644 --- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs +++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs @@ -30,17 +30,28 @@ namespace MediaBrowser.Server.Implementations.Session Sockets = new List<IWebSocketConnection>(); } + private bool HasOpenSockets + { + get { return GetActiveSockets().Any(); } + } + + public bool SupportsMediaControl + { + get { return HasOpenSockets; } + } + + private bool _isActive; public bool IsSessionActive { get { - return Sockets.Any(i => i.State == WebSocketState.Open); + return _isActive; } } - public bool SupportsMediaControl + public void OnActivity() { - get { return GetActiveSockets().Any(); } + _isActive = true; } private IEnumerable<IWebSocketConnection> GetActiveSockets() @@ -64,6 +75,8 @@ namespace MediaBrowser.Server.Implementations.Session { if (!GetActiveSockets().Any()) { + _isActive = false; + try { _sessionManager.ReportSessionEnded(Session.Id); |
