|
@@ -175,19 +175,19 @@ namespace MediaBrowser.Server.Implementations.Session
|
|
|
|
|
|
public async Task ReportSessionEnded(Guid sessionId)
|
|
|
{
|
|
|
- var session = GetSession(sessionId);
|
|
|
+ await _sessionLock.WaitAsync(CancellationToken.None).ConfigureAwait(false);
|
|
|
|
|
|
- if (session == null)
|
|
|
+ try
|
|
|
{
|
|
|
- throw new ArgumentException("Session not found");
|
|
|
- }
|
|
|
+ var session = GetSession(sessionId);
|
|
|
|
|
|
- var key = GetSessionKey(session.Client, session.ApplicationVersion, session.DeviceId);
|
|
|
+ if (session == null)
|
|
|
+ {
|
|
|
+ throw new ArgumentException("Session not found");
|
|
|
+ }
|
|
|
|
|
|
- await _sessionLock.WaitAsync(CancellationToken.None).ConfigureAwait(false);
|
|
|
+ var key = GetSessionKey(session.Client, session.ApplicationVersion, session.DeviceId);
|
|
|
|
|
|
- try
|
|
|
- {
|
|
|
SessionInfo removed;
|
|
|
|
|
|
if (_activeConnections.TryRemove(key, out removed))
|