aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-03-09 22:40:27 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-03-09 22:40:27 -0400
commite3997059d27a414bb46818d0e1e95a5b1723d6dd (patch)
tree21e91fb006384f1f3d1d42c0fa91f53726a9055f
parent9c1ce92c29dcdbed11d805b6b5cc02ff6f58ed95 (diff)
move session examination inside the lock
-rw-r--r--MediaBrowser.Server.Implementations/Session/SessionManager.cs16
1 files changed, 8 insertions, 8 deletions
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
index 11cf5bb9d..71d95b97b 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);
+ 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))