[Modify] Add it

This commit is contained in:
sta 2017-04-15 17:52:58 +09:00
parent 94dcb5c5a8
commit 30f51b0d0f

View File

@ -869,6 +869,28 @@ namespace WebSocketSharp.Server
return broadping (frame.ToArray (), _waitTime); return broadping (frame.ToArray (), _waitTime);
} }
/// <summary>
/// Removes all WebSocket services managed by the manager.
/// </summary>
/// <remarks>
/// A service is stopped with close status 1001 (going away)
/// if it has already started.
/// </remarks>
public void Clear ()
{
List<WebSocketServiceHost> hosts = null;
lock (_sync) {
hosts = _hosts.Values.ToList ();
_hosts.Clear ();
}
foreach (var host in hosts) {
if (host.State == ServerState.Start)
host.Stop (1001, String.Empty);
}
}
/// <summary> /// <summary>
/// Removes a WebSocket service with the specified <paramref name="path"/>. /// Removes a WebSocket service with the specified <paramref name="path"/>.
/// </summary> /// </summary>