diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-07-29 23:31:35 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-07-29 23:31:35 -0400 |
| commit | 51e964dae394ae4a211482d562dbc28e79c00c3c (patch) | |
| tree | 8cc6f351eeb9ceb2343cd818e84b26a94f072a62 /MediaBrowser.Server.Implementations/Session/WebSocketController.cs | |
| parent | 063675bb07f78f99738a3ada061f3e2c16c9cda0 (diff) | |
support channels with dlna
Diffstat (limited to 'MediaBrowser.Server.Implementations/Session/WebSocketController.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Session/WebSocketController.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs index e1d77c268..2d5a30f3d 100644 --- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs +++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs @@ -234,6 +234,8 @@ namespace MediaBrowser.Server.Implementations.Session private Task SendMessage<T>(WebSocketMessage<T> message, CancellationToken cancellationToken) { + if (SkipSending()) return Task.FromResult(true); + var socket = GetActiveSocket(); return socket.SendAsync(message, cancellationToken); @@ -241,6 +243,8 @@ namespace MediaBrowser.Server.Implementations.Session private Task SendMessages<T>(WebSocketMessage<T> message, CancellationToken cancellationToken) { + if (SkipSending()) return Task.FromResult(true); + var tasks = GetActiveSockets().Select(i => Task.Run(async () => { try @@ -257,6 +261,27 @@ namespace MediaBrowser.Server.Implementations.Session return Task.WhenAll(tasks); } + private bool SkipSending() + { + if (Session != null) + { + if (string.Equals(Session.Client, "mb-classic", StringComparison.OrdinalIgnoreCase)) + { + Version version; + + if (!string.IsNullOrWhiteSpace(Session.ApplicationVersion) && Version.TryParse(Session.ApplicationVersion, out version)) + { + if (version < new Version(3, 0, 196)) + { + _logger.Debug("Skipping web socket message to MBC version {0}.", version); + return true; + } + } + } + } + return false; + } + public void Dispose() { foreach (var socket in Sockets.ToList()) |
