/// <summary> /// Adds the specified typed WebSocket service. /// </summary> /// <param name="servicePath"> /// A <see cref="string"/> that contains an absolute path to the WebSocket service. /// </param> /// <typeparam name="T"> /// The type of the WebSocket service. The T must inherit the <see cref="WebSocketService"/> class. /// </typeparam> public void AddWebSocketService <T> (string servicePath) where T : WebSocketService, new () { string msg; if (!servicePath.IsValidAbsolutePath(out msg)) { Log.Error(msg); Error(msg); return; } var host = new WebSocketServiceHost <T> (Log); host.Uri = BaseUri.IsAbsoluteUri ? new Uri(BaseUri, servicePath) : servicePath.ToUri(); if (!KeepClean) { host.KeepClean = false; } _serviceHosts.Add(servicePath, host); }
internal bool InternalTryGetServiceHost(string path, out WebSocketServiceHost host) { path = path.TrimSlashFromEnd(); lock (_sync) return(_hosts.TryGetValue(path, out host)); }
internal bool InternalTryGetServiceHost(string path, out WebSocketServiceHost host) { bool ret = false; host = null; lock (_sync) { path = HttpUtility.UrlDecode(path).TrimEndSlash(); //CM-ADD if (_hosts.Any(s => path.StartsWith(s.Key))) { host = _hosts.First(s => path.StartsWith(s.Key)).Value; } if (host != null) { ret = true; } //ret = _hosts.TryGetValue(path, out host); } if (!ret) { _logger.Error( "A WebSocket service with the specified path isn't found:\n path: " + path); } return(ret); }
internal void Add <TBehavior>(string path, Func <TBehavior> initializer) where TBehavior : WebSocketBehavior { path = HttpUtility.UrlDecode(path).TrimEndSlash(); WebSocketServiceHost host; if (_hosts.TryGetValue(path, out host)) { return; } host = new WebSocketServiceHost <TBehavior>(path, _fragmentSize, initializer); if (!_clean) { host.KeepClean = false; } host.WaitTime = _waitTime; if (_state == ServerState.Start) { host.Start(); } if (!_hosts.TryAdd(path, host)) { throw new Exception("Failed to add host"); } }
/// <summary> /// Adds the specified typed WebSocket service with the specified /// <paramref name="servicePath"/> and <paramref name="serviceConstructor"/>. /// </summary> /// <remarks> /// <para> /// This method converts <paramref name="servicePath"/> to URL-decoded /// string and removes <c>'/'</c> from tail end of /// <paramref name="servicePath"/>. /// </para> /// <para> /// <paramref name="serviceConstructor"/> returns a initialized specified /// typed WebSocket service instance. /// </para> /// </remarks> /// <param name="servicePath"> /// A <see cref="string"/> that represents the absolute path to the WebSocket /// service. /// </param> /// <param name="serviceConstructor"> /// A Func<T> delegate that references the method used to initialize /// a new WebSocket service instance (a new WebSocket session). /// </param> /// <typeparam name="T"> /// The type of the WebSocket service. The T must inherit the /// <see cref="WebSocketService"/> class. /// </typeparam> public void AddWebSocketService <T> ( string servicePath, Func <T> serviceConstructor) where T : WebSocketService { var msg = servicePath.CheckIfValidServicePath() ?? (serviceConstructor == null ? "'serviceConstructor' must not be null." : null); if (msg != null) { _logger.Error( String.Format("{0}\nservice path: {1}", msg, servicePath ?? "")); return; } var host = new WebSocketServiceHost <T> ( servicePath, serviceConstructor, _logger); if (!KeepClean) { host.KeepClean = false; } _serviceHosts.Add(host.ServicePath, host); }
internal void Add <TBehavior> (string path, Func <TBehavior> initializer, object callerContext) where TBehavior : WebSocketBehavior { lock (_sync) { path = HttpUtility.UrlDecode(path).TrimEndSlash(); WebSocketServiceHost host; if (_hosts.TryGetValue(path, out host)) { _logger.Error( "A WebSocket service with the specified path already exists:\n path: " + path); return; } host = new WebSocketServiceHost <TBehavior> (path, initializer, _logger); host.CallerContext = callerContext; if (!_clean) { host.KeepClean = false; } if (_waitTime != host.WaitTime) { host.WaitTime = _waitTime; } if (_state == ServerState.Start) { host.Start(); } _hosts.Add(path, host); } }
/// <summary> /// Tries to get the host instance for a WebSocket service with /// the specified <paramref name="path"/>. /// </summary> /// <remarks> /// <paramref name="path"/> is converted to a URL-decoded string and /// / is trimmed from the end of the converted string if any. /// </remarks> /// <returns> /// <c>true</c> if the service is successfully found; /// otherwise, <c>false</c>. /// </returns> /// <param name="path"> /// A <see cref="string"/> that represents an absolute path to /// the service to find. /// </param> /// <param name="host"> /// <para> /// When this method returns, a <see cref="WebSocketServiceHost"/> /// instance or <see langword="null"/> if not found. /// </para> /// <para> /// That host instance provides the function to access /// the information in the service. /// </para> /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="path"/> is <see langword="null"/>. /// </exception> /// <exception cref="ArgumentException"> /// <para> /// <paramref name="path"/> is empty. /// </para> /// <para> /// -or- /// </para> /// <para> /// <paramref name="path"/> is not an absolute path. /// </para> /// <para> /// -or- /// </para> /// <para> /// <paramref name="path"/> includes either or both /// query and fragment components. /// </para> /// </exception> public bool TryGetServiceHost(string path, out WebSocketServiceHost host) { if (path == null) { throw new ArgumentNullException("path"); } if (path.Length == 0) { throw new ArgumentException("An empty string.", "path"); } if (path[0] != '/') { throw new ArgumentException("Not an absolute path.", "path"); } if (path.IndexOfAny(new[] { '?', '#' }) > -1) { var msg = "It includes either or both query and fragment components."; throw new ArgumentException(msg, "path"); } return(InternalTryGetServiceHost(path, out host)); }
internal void Add <TBehavior> (string path, Func <TBehavior> creator) where TBehavior : WebSocketBehavior { path = HttpUtility.UrlDecode(path).TrimSlashFromEnd(); lock (_sync) { WebSocketServiceHost host; if (_hosts.TryGetValue(path, out host)) { throw new ArgumentException("Already in use.", "path"); } host = new WebSocketServiceHost <TBehavior> ( path, creator, null, _log ); if (!_clean) { host.KeepClean = false; } if (_waitTime != host.WaitTime) { host.WaitTime = _waitTime; } if (_state == ServerState.Start) { host.Start(); } _hosts.Add(path, host); } }
internal void Add <TBehavior>(string path, Func <TBehavior> initializer) where TBehavior : WebSocketBehavior { lock (this._sync) { WebSocketServiceHost host; path = HttpUtility.UrlDecode(path).TrimEndSlash(); if (this._hosts.TryGetValue(path, out host)) { this._logger.Error("A WebSocket service with the specified path already exists:\n path: " + path); } else { host = new WebSocketServiceHost <TBehavior>(path, initializer, this._logger); if (!this._clean) { host.KeepClean = false; } if (this._waitTime != host.WaitTime) { host.WaitTime = this._waitTime; } if (this._state == 1) { host.Start(); } this._hosts.Add(path, host); } } }
internal void Add <TBehavior>(string path, Func <TBehavior> initializer) where TBehavior : WebSocketBehavior { lock (_sync) { path = HttpUtility.UrlDecode(path).TrimEndSlash(); if (_hosts.TryGetValue(path, out var value)) { _logger.Error("A WebSocket service with the specified path already exists.\npath: " + path); return; } value = new WebSocketServiceHost <TBehavior>(path, initializer, _logger); if (!_clean) { value.KeepClean = false; } if (_waitTime != value.WaitTime) { value.WaitTime = _waitTime; } if (_state == ServerState.Start) { value.Start(); } _hosts.Add(path, value); } }
static void Main(string[] args) { LogConsole._Load(); LogDebug.debug = true; _SQL.Init("localhost", "root", "13456", "dbbase", 3306); var wssv = new WebSocketServiceHost<Serverb>("ws://192.168.1.5:8085"); wssv.OnError += (sender, e) => { Console.WriteLine("[WS] error", "WS: Error: " + e.Message, "notification-message-im"); }; wssv.Start(); Console.WriteLine("WebSocket Server listening on port: {0}", wssv.Port); while (true) { Thread.Sleep(1000); string _comm = Console.ReadLine(); switch (_comm) { case "count": Console.WriteLine("Users Online: {0}",Users.Count()); break; default: break; } } //Console.ReadKey(); }
/// <summary> /// Adds a WebSocket service with the specified behavior, path, /// and delegate. /// </summary> /// <param name="path"> /// <para> /// A <see cref="string"/> that represents an absolute path to /// the service to add. /// </para> /// <para> /// / is trimmed from the end of the string if present. /// </para> /// </param> /// <param name="initializer"> /// <para> /// An <c>Action<TBehavior></c> delegate or /// <see langword="null"/> if not needed. /// </para> /// <para> /// The delegate invokes the method called when initializing /// a new session instance for the service. /// </para> /// </param> /// <typeparam name="TBehavior"> /// <para> /// The type of the behavior for the service. /// </para> /// <para> /// It must inherit the <see cref="WebSocketBehavior"/> class. /// </para> /// <para> /// And also, it must have a public parameterless constructor. /// </para> /// </typeparam> /// <exception cref="ArgumentNullException"> /// <paramref name="path"/> is <see langword="null"/>. /// </exception> /// <exception cref="ArgumentException"> /// <para> /// <paramref name="path"/> is empty. /// </para> /// <para> /// -or- /// </para> /// <para> /// <paramref name="path"/> is not an absolute path. /// </para> /// <para> /// -or- /// </para> /// <para> /// <paramref name="path"/> includes either or both /// query and fragment components. /// </para> /// <para> /// -or- /// </para> /// <para> /// <paramref name="path"/> is already in use. /// </para> /// </exception> public void AddService <TBehavior>( string path, Action <TBehavior> initializer ) where TBehavior : WebSocketBehavior, new() { if (path == null) { throw new ArgumentNullException("path"); } if (path.Length == 0) { throw new ArgumentException("An empty string.", "path"); } if (path[0] != '/') { throw new ArgumentException("Not an absolute path.", "path"); } if (path.IndexOfAny(new[] { '?', '#' }) > -1) { var msg = "It includes either or both query and fragment components."; throw new ArgumentException(msg, "path"); } path = path.TrimSlashFromEnd(); lock (_sync) { WebSocketServiceHost host; if (_hosts.TryGetValue(path, out host)) { throw new ArgumentException("Already in use.", "path"); } host = new WebSocketServiceHost <TBehavior>( path, () => new TBehavior(), initializer, _log ); if (!_clean) { host.KeepClean = false; } if (_waitTime != host.WaitTime) { host.WaitTime = _waitTime; } if (_state == ServerState.Start) { host.Start(); } _hosts.Add(path, host); } }
internal bool InternalTryGetServiceHost(string path, out WebSocketServiceHost host, bool logError) { path = HttpUtility.UrlDecode(path).TrimEndSlash(); lock (_sync) { return(_hosts.TryGetValue(path, out host)); } }
internal bool InternalTryGetServiceHost( string path, out WebSocketServiceHost host ) { path = HttpUtility.UrlDecode(path).TrimSlashFromEnd(); lock (_sync) return(_hosts.TryGetValue(path, out host)); }
public bool TryGetServiceHost(string path, out WebSocketServiceHost host) { string text = _state.CheckIfStart() ?? path.CheckIfValidServicePath(); if (text != null) { _logger.Error(text); host = null; return(false); } return(InternalTryGetServiceHost(path, out host)); }
/// <summary> /// Tries to get the WebSocket service host with the specified <paramref name="path"/>. /// </summary> /// <returns> /// <c>true</c> if the service is successfully found; otherwise, <c>false</c>. /// </returns> /// <param name="path"> /// A <see cref="string"/> that represents the absolute path to the service to find. /// </param> /// <param name="host"> /// When this method returns, a <see cref="WebSocketServiceHost"/> instance that provides /// the access to the information in the service, or <see langword="null"/> if it's not found. /// This parameter is passed uninitialized. /// </param> private bool TryGetServiceHost(string path, out WebSocketServiceHost host) { var msg = _state.CheckIfStart() ?? path.CheckIfValidServicePath(); if (msg != null) { host = null; return(false); } return(InternalTryGetServiceHost(path, out host)); }
/// <summary> /// Tries to get a WebSocket service host with the specified <paramref name="servicePath"/>. /// </summary> /// <returns> /// <c>true</c> if the service is successfully found; otherwise, <c>false</c>. /// </returns> /// <param name="servicePath"> /// A <see cref="string"/> that contains an absolute path to the service to find. /// </param> /// <param name="serviceHost"> /// When this method returns, a <see cref="WebSocketServiceHost"/> instance that represents /// the service host if the service is successfully found; otherwise, <see langword="null"/>. /// This parameter is passed uninitialized. /// </param> public bool TryGetServiceHost(string servicePath, out WebSocketServiceHost serviceHost) { var msg = _state.CheckIfStarted() ?? servicePath.CheckIfValidServicePath(); if (msg != null) { _logger.Error(msg); serviceHost = null; return(false); } return(TryGetServiceHostInternally(servicePath, out serviceHost)); }
/// <summary> /// Tries to get the WebSocket service host with the specified <paramref name="path"/>. /// </summary> /// <returns> /// <c>true</c> if the service is successfully found; otherwise, <c>false</c>. /// </returns> /// <param name="path"> /// A <see cref="string"/> that represents the absolute path to the service to find. /// </param> /// <param name="host"> /// When this method returns, a <see cref="WebSocketServiceHost"/> instance that /// provides the access to the information in the service, or <see langword="null"/> /// if it's not found. This parameter is passed uninitialized. /// </param> public bool TryGetServiceHost(string path, out WebSocketServiceHost host) { var msg = _state.CheckIfAvailable(false, true, false) ?? path.CheckIfValidServicePath(); if (msg != null) { _logger.Error(msg); host = null; return(false); } return(InternalTryGetServiceHost(path, out host)); }
internal bool InternalTryGetServiceHost(string path, out WebSocketServiceHost host) { bool flag; lock (_sync) { path = HttpUtility.UrlDecode(path).TrimEndSlash(); flag = _hosts.TryGetValue(path, out host); } if (!flag) { _logger.Error("A WebSocket service with the specified path isn't found.\npath: " + path); } return(flag); }
internal bool TryGetServiceHostInternally(string path, out WebSocketServiceHost host) { path = HttpUtility.UrlDecode(path).TrimEndSlash(); object sync = this._sync; bool flag; lock (sync) { flag = this._hosts.TryGetValue(path, out host); } if (!flag) { this._logger.Error("A WebSocket service with the specified path not found.\npath: " + path); } return(flag); }
public bool TryGetServiceHost(string path, out WebSocketServiceHost host) { bool flag; string str = ((ServerState)this._state).CheckIfAvailable(false, true, false) ?? path.CheckIfValidServicePath(); if (str == null) { flag = this.InternalTryGetServiceHost(path, out host); } else { this._logger.Error(str); host = null; flag = false; } return(flag); }
internal bool TryGetServiceHostInternally(string servicePath, out WebSocketServiceHost serviceHost) { servicePath = HttpUtility.UrlDecode(servicePath).TrimEndSlash(); bool result; lock (_sync) { result = _serviceHosts.TryGetValue(servicePath, out serviceHost); } if (!result) { _logger.Error("A WebSocket service with the specified path not found.\npath: " + servicePath); } return(result); }
public void AddWebSocketService <T>(string path, Func <T> constructor) where T : WebSocketService { string text = path.CheckIfValidServicePath() ?? ((constructor != null) ? null : "'constructor' must not be null."); if (text != null) { this._logger.Error(string.Format("{0}\nservice path: {1}", text, path)); return; } WebSocketServiceHost <T> webSocketServiceHost = new WebSocketServiceHost <T>(path, constructor, this._logger); if (!this.KeepClean) { webSocketServiceHost.KeepClean = false; } this._services.Add(webSocketServiceHost.Path, webSocketServiceHost); }
internal void Add(string servicePath, WebSocketServiceHost serviceHost) { lock (_sync) { WebSocketServiceHost host; if (_serviceHosts.TryGetValue(servicePath, out host)) { _logger.Error( "A WebSocket service with the specified path already exists.\npath: " + servicePath); return; } if (_state == ServerState.START) { serviceHost.Sessions.Start(); } _serviceHosts.Add(servicePath, serviceHost); } }
internal void Add(string path, WebSocketServiceHost host) { lock (_sync) { WebSocketServiceHost find; if (_hosts.TryGetValue(path, out find)) { _logger.Error( "A WebSocket service with the specified path already exists.\npath: " + path); return; } if (_state == ServerState.Start) { host.Sessions.Start(); } _hosts.Add(path, host); } }
public void AddService <T>(string absPath) where T : WebSocketService, new() { string msg; if (!Ext.IsValidAbsolutePath(absPath, out msg)) { onError(msg); return; } var svcHost = new WebSocketServiceHost <T>(); svcHost.Uri = Ext.ToUri(absPath); if (!Sweeped) { svcHost.Sweeped = Sweeped; } _services.Add(absPath, svcHost); }
internal void Add(string path, WebSocketServiceHost host) { object sync = this._sync; lock (sync) { WebSocketServiceHost webSocketServiceHost; if (this._hosts.TryGetValue(path, out webSocketServiceHost)) { this._logger.Error("A WebSocket service with the specified path already exists.\npath: " + path); } else { if (this._state == ServerState.Start) { host.Sessions.Start(); } this._hosts.Add(path, host); } } }
/// <summary> /// Adds the specified type WebSocket service. /// </summary> /// <param name="absPath"> /// A <see cref="string"/> that contains an absolute path associated with the WebSocket service. /// </param> /// <typeparam name="T"> /// The type of the WebSocket service. The T must inherit the <see cref="WebSocketService"/> class. /// </typeparam> public void AddWebSocketService <T>(string absPath) where T : WebSocketService, new() { string msg; if (!absPath.IsValidAbsolutePath(out msg)) { onError(msg); return; } var svcHost = new WebSocketServiceHost <T>(); svcHost.Uri = absPath.ToUri(); if (!Sweeping) { svcHost.Sweeping = false; } _svcHosts.Add(absPath, svcHost); }
/// <summary> /// Tries to get the WebSocket service host with the specified <paramref name="path"/>. /// </summary> /// <returns> /// <c>true</c> if the service is successfully found; otherwise, <c>false</c>. /// </returns> /// <param name="path"> /// A <see cref="string"/> that represents the absolute path to the service to find. /// </param> /// <param name="host"> /// When this method returns, a <see cref="WebSocketServiceHost"/> /// instance that provides the access to the information in /// the service or <see langword="null"/> if it is not found. /// </param> public bool TryGetServiceHost(string path, out WebSocketServiceHost host) { host = null; if (path == null || path.Length == 0) { return(false); } if (path[0] != '/') { return(false); } if (path.IndexOfAny(new[] { '?', '#' }) > -1) { return(false); } return(InternalTryGetServiceHost(path, out host, true)); }
/// <summary> /// Adds a WebSocket service with the specified behavior, <paramref name="path"/>, /// and <paramref name="initializer"/>. /// </summary> /// <remarks> /// <para> /// This method converts <paramref name="path"/> to URL-decoded string, /// and removes <c>'/'</c> from tail end of <paramref name="path"/>. /// </para> /// <para> /// <paramref name="initializer"/> returns an initialized specified typed /// <see cref="WebSocketBehavior"/> instance. /// </para> /// </remarks> /// <param name="path"> /// A <see cref="string"/> that represents the absolute path to the service to add. /// </param> /// <param name="initializer"> /// A Func<T> delegate that references the method used to initialize a new specified /// typed <see cref="WebSocketBehavior"/> instance (a new <see cref="IWebSocketSession"/> /// instance). /// </param> /// <typeparam name="TBehavior"> /// The type of the behavior of the service to add. The TBehavior must inherit /// the <see cref="WebSocketBehavior"/> class. /// </typeparam> public void AddWebSocketService <TBehavior> (string path, Func <TBehavior> initializer) where TBehavior : WebSocketBehavior { var msg = path.CheckIfValidServicePath() ?? (initializer == null ? "'initializer' is null." : null); if (msg != null) { _logger.Error(String.Format("{0}\nservice path: {1}", msg, path)); return; } var host = new WebSocketServiceHost <TBehavior> (path, initializer, _logger); if (!KeepClean) { host.KeepClean = false; } _services.Add(host.Path, host); }
internal bool InternalTryGetServiceHost(string path, out WebSocketServiceHost host) { bool flag; object obj = this._sync; Monitor.Enter(obj); try { path = HttpUtility.UrlDecode(path).TrimEndSlash(); flag = this._hosts.TryGetValue(path, out host); } finally { Monitor.Exit(obj); } if (!flag) { this._logger.Error(string.Concat("A WebSocket service with the specified path isn't found:\n path: ", path)); } return(flag); }
internal bool TryGetServiceHostInternally(string path, out WebSocketServiceHost host) { path = HttpUtility.UrlDecode (path).TrimEndSlash (); bool result; lock (_sync) { result = _hosts.TryGetValue (path, out host); } if (!result) _logger.Error ("A WebSocket service with the specified path not found.\npath: " + path); return result; }
internal void Add(string servicePath, WebSocketServiceHost serviceHost) { lock (_sync) { WebSocketServiceHost host; if (_serviceHosts.TryGetValue (servicePath, out host)) { _logger.Error ( "A WebSocket service with the specified path already exists.\npath: " + servicePath); return; } if (_state == ServerState.START) serviceHost.Sessions.Start (); _serviceHosts.Add (servicePath, serviceHost); } }
static void Main(string[] args) { LogConsole._Load(); PATH = Environment.CurrentDirectory.ToString(); Inix ini = null; #region Load Settings try { if (File.Exists(PATH + @"\Settings\Settings.ini")) { ini = new Inix(PATH + @"\Settings\Settings.ini"); LSPort = ini.GetValue("Server", "port", 9002).ToString(); LSIP = ini.GetValue("Server", "ip", "localhost").ToString(); MIp = ini.GetValue("MySql", "ip", "localhost").ToString(); MUser = ini.GetValue("MySql", "user", "root").ToString(); MPass = ini.GetValue("MySql", "pass", "").ToString(); MDb = ini.GetValue("MySql", "db", "db_clone").ToString(); MPort = Convert.ToInt32(ini.GetValue("MySql", "port", 3306)); debug = Convert.ToBoolean(ini.GetValue("Console", "debug", false)); ini = null; LogConsole.Show(LogType.INFO, "Has loaded your ip settings successfully"); } else { LogConsole.Show(LogType.ALERT, "Settings.ini could not be found, using default setting"); } } catch (Exception excc) { LogConsole.Show(LogType.ERROR, " {0}", excc.ToString()); return; } #endregion _SQL.Init(MIp, MUser, MPass, MDb, MPort); MapsL.LoadMaps.Load(); WSurl = WSurl + LSIP + ":" + LSPort; var wssv = new WebSocketServiceHost<Serverb>(WSurl); wssv.OnError += (sender, e) => { LogConsole.Show(LogType.ERROR, "[WS]: Error {0} ", e.Message); }; wssv.Start(); LogConsole.Show(LogType.ALERT, "Server Listening on port: {0}", wssv.Port); _LoopThrreading = new Thread(new ThreadStart(Program.LoopConsole)); _LoopThrreading.Priority = ThreadPriority.BelowNormal; _LoopThrreading.Start(); while (true) { Thread.Sleep(1000); string _comm = Console.ReadLine(); switch (_comm) { case "online": LogConsole.Show(LogType.INFO, "Users Online: {0}", Users.Count()); break; default: break; } } }
/// <summary> /// Tries to get the information in a WebSocket service with the specified /// <paramref name="path"/>. /// </summary> /// <returns> /// <c>true</c> if the WebSocket service is successfully found; otherwise, <c>false</c>. /// </returns> /// <param name="path"> /// A <see cref="string"/> that represents the absolute path to the WebSocket service to find. /// </param> /// <param name="host"> /// When this method returns, a <see cref="WebSocketServiceHost"/> instance that /// provides the access to the WebSocket service if it's successfully found; /// otherwise, <see langword="null"/>. This parameter is passed uninitialized. /// </param> public bool TryGetServiceHost(string path, out WebSocketServiceHost host) { var msg = _state.CheckIfStart () ?? path.CheckIfValidServicePath (); if (msg != null) { _logger.Error (msg); host = null; return false; } return TryGetServiceHostInternally (path, out host); }
internal void Add(string path, WebSocketServiceHost host) { lock (_sync) { WebSocketServiceHost find; if (_hosts.TryGetValue (path, out find)) { _logger.Error ( "A WebSocket service with the specified path already exists.\npath: " + path); return; } if (_state == ServerState.Start) host.Sessions.Start (); _hosts.Add (path, host); } }