aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Session
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2019-12-26 20:57:46 +0100
committerBond_009 <bond.009@outlook.com>2020-01-13 20:06:08 +0100
commit5ca68f9623e414b85ddbda1f97895f1b90bd05e0 (patch)
tree8360af78a08b0b84b2a4854e35df1ab5e55f6c80 /Emby.Server.Implementations/Session
parent976459d3e8a8b889cebc2cf281e38b0fbc19c9b9 (diff)
Fix nullref exception and added logging
Diffstat (limited to 'Emby.Server.Implementations/Session')
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs3
-rw-r--r--Emby.Server.Implementations/Session/SessionWebSocketListener.cs2
-rw-r--r--Emby.Server.Implementations/Session/WebSocketController.cs5
3 files changed, 6 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index db00ceeb7..0d5df1dad 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -1726,6 +1726,7 @@ namespace Emby.Server.Implementations.Session
string.Equals(i.Client, client));
}
+ /// <inheritdoc />
public SessionInfo GetSessionByAuthenticationToken(AuthenticationInfo info, string deviceId, string remoteEndpoint, string appVersion)
{
if (info == null)
@@ -1733,7 +1734,7 @@ namespace Emby.Server.Implementations.Session
throw new ArgumentNullException(nameof(info));
}
- var user = info.UserId.Equals(Guid.Empty)
+ var user = info.UserId == Guid.Empty
? null
: _userManager.GetUserById(info.UserId);
diff --git a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
index 13b42698d..d4e4ba1f2 100644
--- a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
+++ b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
@@ -56,7 +56,7 @@ namespace Emby.Server.Implementations.Session
}
else
{
- _logger.LogWarning("Unable to determine session based on url: {0}", e.Argument.Url);
+ _logger.LogWarning("Unable to determine session based on query string: {0}", e.Argument.QueryString);
}
}
diff --git a/Emby.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.cs
index c17e67da9..536013c7a 100644
--- a/Emby.Server.Implementations/Session/WebSocketController.cs
+++ b/Emby.Server.Implementations/Session/WebSocketController.cs
@@ -53,11 +53,12 @@ namespace Emby.Server.Implementations.Session
private void OnConnectionClosed(object sender, EventArgs e)
{
- _logger.LogDebug("Removing websocket from session {Session}", _session.Id);
var connection = (IWebSocketConnection)sender;
+ _logger.LogDebug("Removing websocket from session {Session}", _session.Id);
_sockets.Remove(connection);
- _sessionManager.CloseIfNeeded(_session);
+ connection.Closed -= OnConnectionClosed;
connection.Dispose();
+ _sessionManager.CloseIfNeeded(_session);
}
/// <inheritdoc />