added periodic ping to http session controller

This commit is contained in:
Luke Pulverenti
2014-05-28 11:51:42 -04:00
parent 29ba865ab8
commit cb7fb3ae5c
4 changed files with 76 additions and 36 deletions

View File

@@ -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);
}
}