From e3997059d27a414bb46818d0e1e95a5b1723d6dd Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 9 Mar 2014 22:40:27 -0400 Subject: [PATCH] move session examination inside the lock --- .../Session/SessionManager.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 11cf5bb9d7..71d95b97bd 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -175,19 +175,19 @@ namespace MediaBrowser.Server.Implementations.Session public async Task ReportSessionEnded(Guid sessionId) { - var session = GetSession(sessionId); - - if (session == null) - { - throw new ArgumentException("Session not found"); - } - - var key = GetSessionKey(session.Client, session.ApplicationVersion, session.DeviceId); - await _sessionLock.WaitAsync(CancellationToken.None).ConfigureAwait(false); try { + var session = GetSession(sessionId); + + if (session == null) + { + throw new ArgumentException("Session not found"); + } + + var key = GetSessionKey(session.Client, session.ApplicationVersion, session.DeviceId); + SessionInfo removed; if (_activeConnections.TryRemove(key, out removed))