From 0619717f38a26879b08d18029c86847e88b3df8d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 30 May 2016 12:08:46 -0400 Subject: ignore socket error --- MediaBrowser.Server.Implementations/Session/SessionManager.cs | 5 +++++ .../Session/SessionWebSocketListener.cs | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations/Session') diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 77843ef6b2..0dabcac4be 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -1748,6 +1748,11 @@ namespace MediaBrowser.Server.Implementations.Session public void ReportNowViewingItem(string sessionId, string itemId) { + if (string.IsNullOrWhiteSpace(itemId)) + { + throw new ArgumentNullException("itemId"); + } + var item = _libraryManager.GetItemById(new Guid(itemId)); var info = GetItemInfo(item, null, null); diff --git a/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs b/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs index 602bc4876b..ddd7ba53a6 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs @@ -230,7 +230,12 @@ namespace MediaBrowser.Server.Implementations.Session { var vals = message.Data.Split('|'); - _sessionManager.ReportNowViewingItem(session.Id, vals[1]); + var itemId = vals[1]; + + if (!string.IsNullOrWhiteSpace(itemId)) + { + _sessionManager.ReportNowViewingItem(session.Id, itemId); + } } } -- cgit v1.2.3 From ca100ff2d13b0bf885826e02e7c1ed6a4496694e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 30 May 2016 12:22:31 -0400 Subject: add null checks on session & device creation --- MediaBrowser.Server.Implementations/Devices/DeviceManager.cs | 5 +++++ MediaBrowser.Server.Implementations/Session/SessionManager.cs | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'MediaBrowser.Server.Implementations/Session') diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs index 6b1af8d2d9..c3db9140cf 100644 --- a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs +++ b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs @@ -51,6 +51,11 @@ namespace MediaBrowser.Server.Implementations.Devices public async Task RegisterDevice(string reportedId, string name, string appName, string appVersion, string usedByUserId) { + if (string.IsNullOrWhiteSpace(reportedId)) + { + throw new ArgumentNullException("reportedId"); + } + var device = GetDevice(reportedId) ?? new DeviceInfo { Id = reportedId diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 0dabcac4be..4386b785ad 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -404,6 +404,10 @@ namespace MediaBrowser.Server.Implementations.Session /// SessionInfo. private async Task GetSessionInfo(string appName, string appVersion, string deviceId, string deviceName, string remoteEndPoint, User user) { + if (string.IsNullOrWhiteSpace(deviceId)) + { + throw new ArgumentNullException("deviceId"); + } var key = GetSessionKey(appName, deviceId); await _sessionLock.WaitAsync(CancellationToken.None).ConfigureAwait(false); -- cgit v1.2.3