Prechádzať zdrojové kódy

reduce socket activity

Luke Pulverenti 7 rokov pred
rodič
commit
983b51e083

+ 15 - 5
Emby.Dlna/Eventing/EventManager.cs

@@ -26,9 +26,11 @@ namespace Emby.Dlna.Eventing
             _logger = logger;
             _logger = logger;
         }
         }
 
 
-        public EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string requestedTimeoutString)
+        public EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string notificationType, string requestedTimeoutString, string callbackUrl)
         {
         {
-            var subscription = GetSubscription(subscriptionId, true);
+            var subscription = GetSubscription(subscriptionId, false);
+
+            int timeoutSeconds;
 
 
             // Remove logging for now because some devices are sending this very frequently
             // Remove logging for now because some devices are sending this very frequently
             // TODO re-enable with dlna debug logging setting
             // TODO re-enable with dlna debug logging setting
@@ -37,10 +39,18 @@ namespace Emby.Dlna.Eventing
             //    timeout,
             //    timeout,
             //    subscription.CallbackUrl);
             //    subscription.CallbackUrl);
 
 
-            subscription.TimeoutSeconds = ParseTimeout(requestedTimeoutString) ?? 300;
-            subscription.SubscriptionTime = DateTime.UtcNow;
+            if (subscription != null)
+            {
+                subscription.TimeoutSeconds = ParseTimeout(requestedTimeoutString) ?? 300;
+                timeoutSeconds = subscription.TimeoutSeconds;
+                subscription.SubscriptionTime = DateTime.UtcNow;
+            }
+            else
+            {
+                timeoutSeconds = 300;
+            }
 
 
-            return GetEventSubscriptionResponse(subscriptionId, requestedTimeoutString, subscription.TimeoutSeconds);
+            return GetEventSubscriptionResponse(subscriptionId, requestedTimeoutString, timeoutSeconds);
         }
         }
 
 
         public EventSubscriptionResponse CreateEventSubscription(string notificationType, string requestedTimeoutString, string callbackUrl)
         public EventSubscriptionResponse CreateEventSubscription(string notificationType, string requestedTimeoutString, string callbackUrl)

+ 2 - 2
Emby.Dlna/Service/BaseService.cs

@@ -24,9 +24,9 @@ namespace Emby.Dlna.Service
             return EventManager.CancelEventSubscription(subscriptionId);
             return EventManager.CancelEventSubscription(subscriptionId);
         }
         }
 
 
-        public EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string timeoutString)
+        public EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string notificationType, string timeoutString, string callbackUrl)
         {
         {
-            return EventManager.RenewEventSubscription(subscriptionId, timeoutString);
+            return EventManager.RenewEventSubscription(subscriptionId, notificationType, timeoutString, callbackUrl);
         }
         }
 
 
         public EventSubscriptionResponse CreateEventSubscription(string notificationType, string timeoutString, string callbackUrl)
         public EventSubscriptionResponse CreateEventSubscription(string notificationType, string timeoutString, string callbackUrl)

+ 21 - 0
Emby.Server.Implementations/IO/ManagedFileSystem.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
@@ -24,12 +25,14 @@ namespace Emby.Server.Implementations.IO
         private string _tempPath;
         private string _tempPath;
 
 
         private SharpCifsFileSystem _sharpCifsFileSystem;
         private SharpCifsFileSystem _sharpCifsFileSystem;
+        private IEnvironmentInfo _environmentInfo;
 
 
         public ManagedFileSystem(ILogger logger, IEnvironmentInfo environmentInfo, string tempPath)
         public ManagedFileSystem(ILogger logger, IEnvironmentInfo environmentInfo, string tempPath)
         {
         {
             Logger = logger;
             Logger = logger;
             _supportsAsyncFileStreams = true;
             _supportsAsyncFileStreams = true;
             _tempPath = tempPath;
             _tempPath = tempPath;
+            _environmentInfo = environmentInfo;
 
 
             // On Linux, this needs to be true or symbolic links are ignored
             // On Linux, this needs to be true or symbolic links are ignored
             EnableFileSystemRequestConcat = environmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows &&
             EnableFileSystemRequestConcat = environmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows &&
@@ -1051,7 +1054,25 @@ namespace Emby.Server.Implementations.IO
 
 
         public virtual void SetExecutable(string path)
         public virtual void SetExecutable(string path)
         {
         {
+            if (_environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.OSX)
+            {
+                RunProcess("chmod", "+x \"" + path + "\"", GetDirectoryName(path));
+            }
+        }
 
 
+        private void RunProcess(string path, string args, string workingDirectory)
+        {
+            using (var process = Process.Start(new ProcessStartInfo
+            {
+                Arguments = args,
+                FileName = path,
+                CreateNoWindow = true,
+                WorkingDirectory = workingDirectory,
+                WindowStyle = ProcessWindowStyle.Normal
+            }))
+            {
+                process.WaitForExit();
+            }
         }
         }
     }
     }
 }
 }

+ 0 - 5
Emby.Server.Implementations/Updates/InstallationManager.cs

@@ -442,11 +442,6 @@ namespace Emby.Server.Implementations.Updates
         /// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns>
         /// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns>
         public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken)
         public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken)
         {
         {
-            if (!_config.CommonConfiguration.EnableAutoUpdate)
-            {
-                return new PackageVersionInfo[] { };
-            }
-
             var catalog = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
             var catalog = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
 
 
             var systemUpdateLevel = GetSystemUpdateLevel();
             var systemUpdateLevel = GetSystemUpdateLevel();

+ 1 - 1
MediaBrowser.Api/Dlna/DlnaServerService.cs

@@ -246,7 +246,7 @@ namespace MediaBrowser.Api.Dlna
 
 
                 if (string.IsNullOrEmpty(notificationType))
                 if (string.IsNullOrEmpty(notificationType))
                 {
                 {
-                    return GetSubscriptionResponse(eventManager.RenewEventSubscription(subscriptionId, timeoutString));
+                    return GetSubscriptionResponse(eventManager.RenewEventSubscription(subscriptionId, notificationType, timeoutString, callback));
                 }
                 }
 
 
                 return GetSubscriptionResponse(eventManager.CreateEventSubscription(notificationType, timeoutString, callback));
                 return GetSubscriptionResponse(eventManager.CreateEventSubscription(notificationType, timeoutString, callback));

+ 0 - 1
MediaBrowser.Api/MediaBrowser.Api.csproj

@@ -40,7 +40,6 @@
     <Compile Include="..\SharedVersion.cs">
     <Compile Include="..\SharedVersion.cs">
       <Link>Properties\SharedVersion.cs</Link>
       <Link>Properties\SharedVersion.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="BasePeriodicWebSocketListener.cs" />
     <Compile Include="BrandingService.cs" />
     <Compile Include="BrandingService.cs" />
     <Compile Include="ChannelService.cs" />
     <Compile Include="ChannelService.cs" />
     <Compile Include="Devices\DeviceService.cs" />
     <Compile Include="Devices\DeviceService.cs" />

+ 1 - 0
MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs

@@ -4,6 +4,7 @@ using MediaBrowser.Model.Tasks;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using MediaBrowser.Controller.Net;
 using MediaBrowser.Model.Threading;
 using MediaBrowser.Model.Threading;
 
 
 namespace MediaBrowser.Api.ScheduledTasks
 namespace MediaBrowser.Api.ScheduledTasks

+ 1 - 0
MediaBrowser.Api/System/ActivityLogWebSocketListener.cs

@@ -3,6 +3,7 @@ using MediaBrowser.Model.Events;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using MediaBrowser.Controller.Net;
 using MediaBrowser.Model.Threading;
 using MediaBrowser.Model.Threading;
 
 
 namespace MediaBrowser.Api.System
 namespace MediaBrowser.Api.System

+ 3 - 1
MediaBrowser.Api/UserLibrary/ItemsService.cs

@@ -117,7 +117,9 @@ namespace MediaBrowser.Api.UserLibrary
                 IsVirtualItem = false,
                 IsVirtualItem = false,
                 CollapseBoxSetItems = false,
                 CollapseBoxSetItems = false,
                 EnableTotalRecordCount = request.EnableTotalRecordCount,
                 EnableTotalRecordCount = request.EnableTotalRecordCount,
-                AncestorIds = ancestorIds.ToArray()
+                AncestorIds = ancestorIds.ToArray(),
+                IncludeItemTypes = request.GetIncludeItemTypes(),
+                ExcludeItemTypes = request.GetExcludeItemTypes()
             });
             });
 
 
             var returnItems = _dtoService.GetBaseItemDtos(itemsResult.Items, options, user);
             var returnItems = _dtoService.GetBaseItemDtos(itemsResult.Items, options, user);

+ 1 - 1
MediaBrowser.Controller/Dlna/IEventManager.cs

@@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.Dlna
         /// <summary>
         /// <summary>
         /// Renews the event subscription.
         /// Renews the event subscription.
         /// </summary>
         /// </summary>
-        EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string requestedTimeoutString);
+        EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string notificationType, string requestedTimeoutString, string callbackUrl);
 
 
         /// <summary>
         /// <summary>
         /// Creates the event subscription.
         /// Creates the event subscription.

+ 1 - 0
MediaBrowser.Controller/MediaBrowser.Controller.csproj

@@ -176,6 +176,7 @@
     <Compile Include="MediaEncoding\MediaStreamSelector.cs" />
     <Compile Include="MediaEncoding\MediaStreamSelector.cs" />
     <Compile Include="Net\AuthenticatedAttribute.cs" />
     <Compile Include="Net\AuthenticatedAttribute.cs" />
     <Compile Include="Net\AuthorizationInfo.cs" />
     <Compile Include="Net\AuthorizationInfo.cs" />
+    <Compile Include="Net\BasePeriodicWebSocketListener.cs" />
     <Compile Include="Net\IAuthorizationContext.cs" />
     <Compile Include="Net\IAuthorizationContext.cs" />
     <Compile Include="Net\IAuthService.cs" />
     <Compile Include="Net\IAuthService.cs" />
     <Compile Include="Net\IHasResultFactory.cs" />
     <Compile Include="Net\IHasResultFactory.cs" />

+ 2 - 3
MediaBrowser.Api/BasePeriodicWebSocketListener.cs → MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs

@@ -4,12 +4,11 @@ using System.Globalization;
 using System.Linq;
 using System.Linq;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
-using MediaBrowser.Controller.Net;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Net;
 using MediaBrowser.Model.Net;
 using MediaBrowser.Model.Threading;
 using MediaBrowser.Model.Threading;
 
 
-namespace MediaBrowser.Api
+namespace MediaBrowser.Controller.Net
 {
 {
     /// <summary>
     /// <summary>
     /// Starts sending data over a web socket periodically when a message is received, and then stops when a corresponding stop message is received
     /// Starts sending data over a web socket periodically when a message is received, and then stops when a corresponding stop message is received
@@ -93,7 +92,7 @@ namespace MediaBrowser.Api
         {
         {
             get
             get
             {
             {
-                return true;
+                return false;
             }
             }
         }
         }
 
 

+ 1 - 1
MediaBrowser.WebDashboard/Api/PackageCreator.cs

@@ -265,7 +265,7 @@ namespace MediaBrowser.WebDashboard.Api
                 builder.AppendFormat("window.appMode='{0}';", mode);
                 builder.AppendFormat("window.appMode='{0}';", mode);
             }
             }
 
 
-            if (string.IsNullOrWhiteSpace(mode))
+            else
             {
             {
                 builder.AppendFormat("window.dashboardVersion='{0}';", version);
                 builder.AppendFormat("window.dashboardVersion='{0}';", version);
             }
             }