diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-06 20:49:33 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-06 20:49:33 -0400 |
| commit | 3f1cafdc814c6d0ef866f1c68dcb4dd1034099ec (patch) | |
| tree | c16390ad4e6f2b5ca1406ab1f77a9a5cf364869f | |
| parent | bd5bf32aba45f3a4dff4f883505ddf9fb528e53a (diff) | |
updated nuget
| -rw-r--r-- | MediaBrowser.Common.Implementations/BaseApplicationHost.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs | 13 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/MainStartup.cs | 36 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.Internal.nuspec | 4 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.nuspec | 2 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Server.Core.nuspec | 4 |
6 files changed, 17 insertions, 44 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 9c77b8627..e7a9c00c6 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/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) { diff --git a/MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs b/MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs index 251083dc2..8be35071a 100644 --- a/MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs +++ b/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; } } diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 577f5ea38..e69d46661 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/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); diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 92c8f2c05..b7fd2a38f 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/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" /> diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 3baf5d96f..f6b3aeef8 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/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> diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 147850f29..b8227fa04 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/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> |
