diff options
| author | Tthecreator <epostvanthomas@kpnmail.nl> | 2019-01-22 15:22:42 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-22 15:22:42 +0000 |
| commit | 189b99df16bd4c93cc96422d7282d01d9ff5b82f (patch) | |
| tree | 26d7da95fe3e3b2772b8b39a2463a6c0ac7652fc /Emby.Server.Implementations/Session | |
| parent | a00c0defa8cb22774f5dc8a7d566eb36ac7307e8 (diff) | |
| parent | edcfd8b565f632088c8b1f826db8e2fbecf9790d (diff) | |
Merge pull request #1 from jellyfin/dev
Update from jellyfin repo
Diffstat (limited to 'Emby.Server.Implementations/Session')
4 files changed, 54 insertions, 52 deletions
diff --git a/Emby.Server.Implementations/Session/HttpSessionController.cs b/Emby.Server.Implementations/Session/HttpSessionController.cs index c61e2aff4..9281f82b3 100644 --- a/Emby.Server.Implementations/Session/HttpSessionController.cs +++ b/Emby.Server.Implementations/Session/HttpSessionController.cs @@ -1,9 +1,3 @@ -using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Session; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Session; -using MediaBrowser.Model.System; using System; using System.Collections.Generic; using System.Globalization; @@ -11,6 +5,10 @@ using System.Linq; using System.Net; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Session; +using MediaBrowser.Model.Serialization; +using MediaBrowser.Model.Session; namespace Emby.Server.Implementations.Session { @@ -107,7 +105,7 @@ namespace Emby.Server.Implementations.Session return SendMessage(command.Command.ToString(), messageId, args, cancellationToken); } - private string[] _supportedMessages = new string[] { }; + private string[] _supportedMessages = new string[] { }; public Task SendMessage<T>(string name, string messageId, T data, ISessionController[] allControllers, CancellationToken cancellationToken) { if (!IsSessionActive) diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 4e444ac01..b03345e03 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -1,13 +1,22 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; using MediaBrowser.Common.Events; using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Net; using MediaBrowser.Controller; +using MediaBrowser.Controller.Authentication; using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Security; using MediaBrowser.Controller.Session; using MediaBrowser.Model.Devices; @@ -15,21 +24,11 @@ using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Events; using MediaBrowser.Model.Library; -using Microsoft.Extensions.Logging; +using MediaBrowser.Model.Querying; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Session; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Controller.Net; -using MediaBrowser.Model.Querying; using MediaBrowser.Model.Threading; -using MediaBrowser.Model.Extensions; -using MediaBrowser.Controller.Authentication; +using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.Session { @@ -91,10 +90,24 @@ namespace Emby.Server.Implementations.Session public event EventHandler<SessionEventArgs> SessionEnded; public event EventHandler<SessionEventArgs> SessionActivity; - public SessionManager(IUserDataManager userDataManager, ILogger logger, ILibraryManager libraryManager, IUserManager userManager, IMusicManager musicManager, IDtoService dtoService, IImageProcessor imageProcessor, IJsonSerializer jsonSerializer, IServerApplicationHost appHost, IHttpClient httpClient, IAuthenticationRepository authRepo, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, ITimerFactory timerFactory) + public SessionManager( + IUserDataManager userDataManager, + ILoggerFactory loggerFactory, + ILibraryManager libraryManager, + IUserManager userManager, + IMusicManager musicManager, + IDtoService dtoService, + IImageProcessor imageProcessor, + IJsonSerializer jsonSerializer, + IServerApplicationHost appHost, + IHttpClient httpClient, + IAuthenticationRepository authRepo, + IDeviceManager deviceManager, + IMediaSourceManager mediaSourceManager, + ITimerFactory timerFactory) { _userDataManager = userDataManager; - _logger = logger; + _logger = loggerFactory.CreateLogger(nameof(SessionManager)); _libraryManager = libraryManager; _userManager = userManager; _musicManager = musicManager; @@ -202,8 +215,8 @@ namespace Emby.Server.Implementations.Session /// <param name="remoteEndPoint">The remote end point.</param> /// <param name="user">The user.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException">user</exception> - /// <exception cref="System.UnauthorizedAccessException"></exception> + /// <exception cref="ArgumentNullException">user</exception> + /// <exception cref="UnauthorizedAccessException"></exception> public SessionInfo LogSessionActivity(string appName, string appVersion, string deviceId, @@ -266,8 +279,7 @@ namespace Emby.Server.Implementations.Session { var key = GetSessionKey(session.Client, session.DeviceId); - SessionInfo removed; - _activeConnections.TryRemove(key, out removed); + _activeConnections.TryRemove(key, out var removed); OnSessionEnded(session); } @@ -282,8 +294,7 @@ namespace Emby.Server.Implementations.Session { var key = GetSessionKey(session.Client, session.DeviceId); - SessionInfo removed; - _activeConnections.TryRemove(key, out removed); + _activeConnections.TryRemove(key, out var removed); OnSessionEnded(session); } @@ -366,7 +377,7 @@ namespace Emby.Server.Implementations.Session /// Removes the now playing item id. /// </summary> /// <param name="session">The session.</param> - /// <exception cref="System.ArgumentNullException">item</exception> + /// <exception cref="ArgumentNullException">item</exception> private void RemoveNowPlayingItem(SessionInfo session) { session.NowPlayingItem = null; @@ -405,7 +416,7 @@ namespace Emby.Server.Implementations.Session CheckDisposed(); - SessionInfo sessionInfo = _activeConnections.GetOrAdd(key, k => + var sessionInfo = _activeConnections.GetOrAdd(key, k => { return CreateSession(k, appName, appVersion, deviceId, deviceName, remoteEndPoint, user); }); @@ -572,7 +583,7 @@ namespace Emby.Server.Implementations.Session /// </summary> /// <param name="info">The info.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException">info</exception> + /// <exception cref="ArgumentNullException">info</exception> public async Task OnPlaybackStart(PlaybackStartInfo info) { CheckDisposed(); @@ -785,8 +796,8 @@ namespace Emby.Server.Implementations.Session /// </summary> /// <param name="info">The info.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException">info</exception> - /// <exception cref="System.ArgumentOutOfRangeException">positionTicks</exception> + /// <exception cref="ArgumentNullException">info</exception> + /// <exception cref="ArgumentOutOfRangeException">positionTicks</exception> public async Task OnPlaybackStopped(PlaybackStopInfo info) { CheckDisposed(); @@ -798,7 +809,7 @@ namespace Emby.Server.Implementations.Session if (info.PositionTicks.HasValue && info.PositionTicks.Value < 0) { - throw new ArgumentOutOfRangeException(nameof(info),"The PlaybackStopInfo's PositionTicks was negative."); + throw new ArgumentOutOfRangeException(nameof(info), "The PlaybackStopInfo's PositionTicks was negative."); } var session = GetSession(info.SessionId); @@ -1285,8 +1296,8 @@ namespace Emby.Server.Implementations.Session /// </summary> /// <param name="sessionId">The session identifier.</param> /// <param name="userId">The user identifier.</param> - /// <exception cref="System.UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception> - /// <exception cref="System.ArgumentException">The requested user is already the primary user of the session.</exception> + /// <exception cref="UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception> + /// <exception cref="ArgumentException">The requested user is already the primary user of the session.</exception> public void AddAdditionalUser(string sessionId, Guid userId) { CheckDisposed(); @@ -1319,8 +1330,8 @@ namespace Emby.Server.Implementations.Session /// </summary> /// <param name="sessionId">The session identifier.</param> /// <param name="userId">The user identifier.</param> - /// <exception cref="System.UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception> - /// <exception cref="System.ArgumentException">The requested user is already the primary user of the session.</exception> + /// <exception cref="UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception> + /// <exception cref="ArgumentException">The requested user is already the primary user of the session.</exception> public void RemoveAdditionalUser(string sessionId, Guid userId) { CheckDisposed(); diff --git a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs index 116e455cf..24903f5e8 100644 --- a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs +++ b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs @@ -1,15 +1,11 @@ +using System; +using System.Threading.Tasks; using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Session; using MediaBrowser.Model.Events; -using Microsoft.Extensions.Logging; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Session; -using System; -using System.Collections.Specialized; -using System.Globalization; -using System.Linq; -using System.Threading.Tasks; using MediaBrowser.Model.Services; +using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.Session { diff --git a/Emby.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.cs index ed34f8721..0d483c55f 100644 --- a/Emby.Server.Implementations/Session/WebSocketController.cs +++ b/Emby.Server.Implementations/Session/WebSocketController.cs @@ -1,16 +1,13 @@ -using MediaBrowser.Controller.Net; -using MediaBrowser.Controller.Session; -using MediaBrowser.Model.Entities; -using Microsoft.Extensions.Logging; -using MediaBrowser.Model.Net; -using MediaBrowser.Model.Session; -using MediaBrowser.Model.System; using System; using System.Collections.Generic; using System.Linq; +using System.Net.WebSockets; using System.Threading; using System.Threading.Tasks; -using System.Net.WebSockets; +using MediaBrowser.Controller.Net; +using MediaBrowser.Controller.Session; +using MediaBrowser.Model.Net; +using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.Session { |
