diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-08-31 15:15:33 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-08-31 15:15:33 -0400 |
| commit | 45db7d21b2a0a18b73253c64651a57c60880b084 (patch) | |
| tree | 3f6eb8bae23c5c7a3cab6e4c4ee34f8b2ba1838f /MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs | |
| parent | 10dedf92adddeae707bae5a4204c8164f5bfea48 (diff) | |
localize plugin installation process
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs index 1cec4461b..16ca8b099 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -14,6 +14,7 @@ using ServiceStack.Host.HttpListener; using ServiceStack.Logging; using ServiceStack.Web; using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; @@ -39,13 +40,15 @@ namespace MediaBrowser.Server.Implementations.HttpServer public event EventHandler<WebSocketConnectEventArgs> WebSocketConnected; + private readonly ConcurrentDictionary<string, string> _localEndPoints = new ConcurrentDictionary<string, string>(StringComparer.OrdinalIgnoreCase); + /// <summary> /// Gets the local end points. /// </summary> /// <value>The local end points.</value> public IEnumerable<string> LocalEndPoints { - get { return _listener == null ? new List<string>() : _listener.LocalEndPoints; } + get { return _listener == null ? new List<string>() : _localEndPoints.Keys.ToList(); } } public HttpListenerHost(IApplicationHost applicationHost, ILogManager logManager, string serviceName, string handlerPath, string defaultRedirectPath, params Assembly[] assembliesWithServices) @@ -151,6 +154,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer return this; } + private void OnRequestReceived(string localEndPoint) + { + _localEndPoints.GetOrAdd(localEndPoint, localEndPoint); + } + /// <summary> /// Starts the Web Service /// </summary> @@ -159,9 +167,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer HostContext.Config.HandlerFactoryPath = ListenerRequest.GetHandlerPathIfAny(UrlPrefixes.First()); _listener = NativeWebSocket.IsSupported - ? _listener = new HttpListenerServer(_logger) + ? _listener = new HttpListenerServer(_logger, OnRequestReceived) //? _listener = new WebSocketSharpListener(_logger) - : _listener = new WebSocketSharpListener(_logger); + : _listener = new WebSocketSharpListener(_logger, OnRequestReceived); _listener.WebSocketHandler = WebSocketHandler; _listener.ErrorHandler = ErrorHandler; |
