Browse Source

updated nuget

Luke Pulverenti 11 năm trước cách đây
mục cha
commit
3f1cafdc81

+ 1 - 1
MediaBrowser.Common.Implementations/BaseApplicationHost.cs

@@ -215,7 +215,7 @@ namespace MediaBrowser.Common.Implementations
             try
             {
                 // Increase the max http request limit
-                ServicePointManager.DefaultConnectionLimit = Math.Min(48, ServicePointManager.DefaultConnectionLimit);
+                ServicePointManager.DefaultConnectionLimit = Math.Max(48, ServicePointManager.DefaultConnectionLimit);
             }
             catch (Exception ex)
             {

+ 2 - 11
MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs

@@ -50,8 +50,6 @@ namespace MediaBrowser.Server.Implementations.WebSocket
         /// <value>The port.</value>
         public int Port { get; private set; }
 
-        private bool _hasStarted;
-
         /// <summary>
         /// Starts the specified port number.
         /// </summary>
@@ -69,8 +67,6 @@ namespace MediaBrowser.Server.Implementations.WebSocket
                 };
 
                 WebSocketServer.Start();
-
-                _hasStarted = true;
             }
             catch (Exception ex)
             {
@@ -141,14 +137,9 @@ namespace MediaBrowser.Server.Implementations.WebSocket
             {
                 if (WebSocketServer != null)
                 {
-                    if (_hasStarted)
-                    {
-                        _logger.Debug("Stopping alchemy server");
-                        WebSocketServer.Stop();
-                    }
-
+                    // Calling dispose will also call stop
                     _logger.Debug("Disposing alchemy server");
-                    WebSocketServer.Dispose();
+                    WebSocketServer.Stop();
                     WebSocketServer = null;
                 }
             }

+ 9 - 27
MediaBrowser.ServerApplication/MainStartup.cs

@@ -26,8 +26,6 @@ namespace MediaBrowser.ServerApplication
 
         private static ILogger _logger;
 
-        private static bool _isRestarting = false;
-
         private static bool _isRunningAsService = false;
 
         /// <summary>
@@ -132,7 +130,7 @@ namespace MediaBrowser.ServerApplication
             if (duplicate != null)
             {
                 _logger.Info("Found a duplicate process. Giving it time to exit.");
-                
+
                 if (!duplicate.WaitForExit(5000))
                 {
                     _logger.Info("The duplicate process did not exit.");
@@ -204,7 +202,7 @@ namespace MediaBrowser.ServerApplication
                 SetErrorMode(ErrorModes.SEM_FAILCRITICALERRORS | ErrorModes.SEM_NOALIGNMENTFAULTEXCEPT |
                              ErrorModes.SEM_NOGPFAULTERRORBOX | ErrorModes.SEM_NOOPENFILEERRORBOX);
             }
-            
+
             _app.Run();
         }
 
@@ -249,13 +247,6 @@ namespace MediaBrowser.ServerApplication
                 SetErrorMode(ErrorModes.SYSTEM_DEFAULT);
             }
 
-            if (_isRestarting)
-            {
-                Process.Start("cmd", "/c net start " + BackgroundService.Name);
-
-                _logger.Info("New service process started");
-            }
-
             _app.Dispatcher.Invoke(_app.Shutdown);
         }
 
@@ -270,6 +261,11 @@ namespace MediaBrowser.ServerApplication
             {
                 ManagedInstallerClass.InstallHelper(new[] { runningPath });
 
+                using (var process = Process.Start("cmd.exe", "/c sc failure " + BackgroundService.Name + " reset= 0 actions= restart/1000/restart/1000/restart/60000"))
+                {
+                    process.WaitForExit();
+                }
+
                 logger.Info("Service installation succeeded");
             }
             catch (Exception ex)
@@ -445,15 +441,6 @@ namespace MediaBrowser.ServerApplication
             _logger.Info("Disposing app host");
             _appHost.Dispose();
 
-            _logger.Info("Starting new instance of server");
-            RestartInternal();
-
-            _logger.Info("Shutting down existing instance of server.");
-            Shutdown();
-        }
-
-        private static void RestartInternal()
-        {
             if (!_isRunningAsService)
             {
                 _logger.Info("Starting server application");
@@ -461,8 +448,8 @@ namespace MediaBrowser.ServerApplication
             }
             else
             {
-                _logger.Info("Starting windows service");
-                RestartWindowsService();
+                _logger.Info("Calling Enviornment.Exit to tell Windows to restart the server.");
+                Environment.Exit(1);
             }
         }
 
@@ -471,11 +458,6 @@ namespace MediaBrowser.ServerApplication
             System.Windows.Forms.Application.Restart();
         }
 
-        private static void RestartWindowsService()
-        {
-            _isRestarting = true;
-        }
-
         private static void ShutdownWindowsApplication()
         {
             _app.Dispatcher.Invoke(_app.Shutdown);

+ 2 - 2
Nuget/MediaBrowser.Common.Internal.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Common.Internal</id>
-        <version>3.0.221</version>
+        <version>3.0.222</version>
         <title>MediaBrowser.Common.Internal</title>
         <authors>Luke</authors>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.221" />
+            <dependency id="MediaBrowser.Common" version="3.0.222" />
             <dependency id="NLog" version="2.0.1.2" />
             <dependency id="ServiceStack.Text" version="3.9.58" />
             <dependency id="SimpleInjector" version="2.3.2" />

+ 1 - 1
Nuget/MediaBrowser.Common.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Common</id>
-        <version>3.0.221</version>
+        <version>3.0.222</version>
         <title>MediaBrowser.Common</title>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>

+ 2 - 2
Nuget/MediaBrowser.Server.Core.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Server.Core</id>
-        <version>3.0.221</version>
+        <version>3.0.222</version>
         <title>Media Browser.Server.Core</title>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains core components required to build plugins for Media Browser Server.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.221" />
+            <dependency id="MediaBrowser.Common" version="3.0.222" />
         </dependencies>
     </metadata>
     <files>