aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-04 11:22:03 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-04 11:22:03 -0400
commitfb98b0c8e0e1b22f006493bd4311c2407cc438db (patch)
treeb9379faac23dacbe78fe766a29ffc4a62d818e82 /MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs
parent16b9d26ab5e52c3c72dd24f17587ca4775ff79dd (diff)
updated nuget
Diffstat (limited to 'MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs')
-rw-r--r--MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs21
1 files changed, 14 insertions, 7 deletions
diff --git a/MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs b/MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs
index 56296ba84..14d468a8e 100644
--- a/MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs
+++ b/MediaBrowser.Server.Implementations/WebSocket/AlchemyServer.cs
@@ -69,7 +69,7 @@ namespace MediaBrowser.Server.Implementations.WebSocket
_hasStarted = true;
}
- catch (SocketException ex)
+ catch (Exception ex)
{
_logger.ErrorException("The web socket server is unable to start on port {0} due to a Socket error. This can occasionally happen when the operating system takes longer than usual to release the IP bindings from the previous session. This can take up to five minutes. Please try waiting or rebooting the system.", ex, portNumber);
@@ -119,21 +119,28 @@ namespace MediaBrowser.Server.Implementations.WebSocket
GC.SuppressFinalize(this);
}
+ private readonly object _syncLock = new object();
+
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool dispose)
{
- if (WebSocketServer != null)
+ lock (_syncLock)
{
- if (_hasStarted)
+ if (WebSocketServer != null)
{
- WebSocketServer.Stop();
+ if (_hasStarted)
+ {
+ _logger.Debug("Stopping alchemy server");
+ WebSocketServer.Stop();
+ }
+
+ _logger.Debug("Disposing alchemy server");
+ WebSocketServer.Dispose();
+ WebSocketServer = null;
}
-
- WebSocketServer.Dispose();
- WebSocketServer = null;
}
}
}