From cb7fb3ae5c786e8f49e99df592fa63c7ac2af862 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 28 May 2014 11:51:42 -0400 Subject: added periodic ping to http session controller --- .../Session/SessionManager.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Session/SessionManager.cs') diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index d78fae87b..0ee9e6213 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -248,7 +248,7 @@ namespace MediaBrowser.Server.Implementations.Session return session; } - public async Task ReportSessionEnded(string sessionId) + public async void ReportSessionEnded(string sessionId) { await _sessionLock.WaitAsync(CancellationToken.None).ConfigureAwait(false); @@ -256,18 +256,16 @@ namespace MediaBrowser.Server.Implementations.Session { var session = GetSession(sessionId); - if (session == null) + if (session != null) { - throw new ArgumentException("Session not found"); - } - - var key = GetSessionKey(session.Client, session.ApplicationVersion, session.DeviceId); + var key = GetSessionKey(session.Client, session.ApplicationVersion, session.DeviceId); - SessionInfo removed; + SessionInfo removed; - if (_activeConnections.TryRemove(key, out removed)) - { - OnSessionEnded(removed); + if (_activeConnections.TryRemove(key, out removed)) + { + OnSessionEnded(removed); + } } } finally @@ -1155,7 +1153,7 @@ namespace MediaBrowser.Server.Implementations.Session if (controller == null) { - session.SessionController = new HttpSessionController(_httpClient, _jsonSerializer, session, postUrl); + session.SessionController = new HttpSessionController(_httpClient, _jsonSerializer, session, postUrl, this); } } -- cgit v1.2.3