Renamed the Sweeping property to the KeepClean property

master
sta 13 years ago
parent ef17cabdd3
commit df2726ce9d

@ -26,7 +26,7 @@ namespace Example2 {
#if DEBUG
wssv.Log.Level = LogLevel.TRACE;
#endif
//wssv.Sweeping = false;
//wssv.KeepClean = false;
wssv.Start ();
Console.WriteLine (
@ -45,7 +45,7 @@ namespace Example2 {
//var file = ConfigurationManager.AppSettings ["ServerCertFile"];
//var password = ConfigurationManager.AppSettings ["CertFilePassword"];
//wssv.Certificate = new X509Certificate2 (file, password);
//wssv.Sweeping = false;
//wssv.KeepClean = false;
wssv.AddWebSocketService<Echo> ("/Echo");
wssv.AddWebSocketService<Chat> ("/Chat");
//wssv.AddWebSocketService<Echo> ("/エコー");

@ -17,7 +17,7 @@ namespace Example3
_httpsv.Log.Level = LogLevel.TRACE;
#endif
_httpsv.RootPath = ConfigurationManager.AppSettings ["RootPath"];
//_httpsv.Sweeping = false;
//_httpsv.KeepClean = false;
_httpsv.AddWebSocketService<Echo> ("/Echo");
_httpsv.AddWebSocketService<Chat> ("/Chat");

@ -96,6 +96,24 @@ namespace WebSocketSharp.Server
}
}
/// <summary>
/// Gets or sets a value indicating whether the server cleans up the inactive WebSocket service
/// instances periodically.
/// </summary>
/// <value>
/// <c>true</c> if the server cleans up the inactive WebSocket service instances every 60 seconds;
/// otherwise, <c>false</c>. The default value is <c>true</c>.
/// </value>
public bool KeepClean {
get {
return _svcHosts.KeepClean;
}
set {
_svcHosts.KeepClean = value;
}
}
/// <summary>
/// Gets the logging functions.
/// </summary>
@ -155,24 +173,6 @@ namespace WebSocketSharp.Server
}
}
/// <summary>
/// Gets or sets a value indicating whether the server cleans up the inactive WebSocket service
/// instances periodically.
/// </summary>
/// <value>
/// <c>true</c> if the server cleans up the inactive WebSocket service instances every 60 seconds;
/// otherwise, <c>false</c>. The default value is <c>true</c>.
/// </value>
public bool Sweeping {
get {
return _svcHosts.Sweeping;
}
set {
_svcHosts.Sweeping = value;
}
}
#endregion
#region Public Events
@ -412,8 +412,8 @@ namespace WebSocketSharp.Server
var svcHost = new WebSocketServiceHost<T> (_logger);
svcHost.Uri = absPath.ToUri ();
if (!Sweeping)
svcHost.Sweeping = false;
if (!KeepClean)
svcHost.KeepClean = false;
_svcHosts.Add (absPath, svcHost);
}

@ -46,7 +46,7 @@ namespace WebSocketSharp.Server {
/// <c>true</c> if the WebSocket service host cleans up the inactive service instances periodically;
/// otherwise, <c>false</c>.
/// </value>
bool Sweeping { get; set; }
bool KeepClean { get; set; }
/// <summary>
/// Binds the specified <see cref="WebSocketContext"/> to a <see cref="WebSocketService"/> instance.

@ -35,8 +35,8 @@ namespace WebSocketSharp.Server {
#region Private Fields
private bool _keepClean;
private Dictionary<string, IServiceHost> _svcHosts;
private bool _sweeping;
#endregion
@ -44,8 +44,8 @@ namespace WebSocketSharp.Server {
public ServiceHostManager()
{
_keepClean = true;
_svcHosts = new Dictionary<string, IServiceHost>();
_sweeping = true;
}
#endregion
@ -58,30 +58,30 @@ namespace WebSocketSharp.Server {
}
}
public IEnumerable<string> Paths {
public bool KeepClean {
get {
return _svcHosts.Keys;
}
return _keepClean;
}
public IEnumerable<IServiceHost> ServiceHosts {
get {
return _svcHosts.Values;
set {
if (_keepClean ^ value)
{
_keepClean = value;
foreach (var svcHost in _svcHosts.Values)
svcHost.KeepClean = value;
}
}
}
public bool Sweeping {
public IEnumerable<string> Paths {
get {
return _sweeping;
return _svcHosts.Keys;
}
set {
if (_sweeping ^ value)
{
_sweeping = value;
foreach (var svcHost in _svcHosts.Values)
svcHost.Sweeping = value;
}
public IEnumerable<IServiceHost> ServiceHosts {
get {
return _svcHosts.Values;
}
}

@ -145,37 +145,37 @@ namespace WebSocketSharp.Server {
#region Public Properties
/// <summary>
/// Gets the collection of paths associated with the every WebSocket services that the server provides.
/// Gets or sets a value indicating whether the server cleans up the inactive WebSocket service
/// instances periodically.
/// </summary>
/// <value>
/// An IEnumerable&lt;string&gt; that contains the collection of paths.
/// <c>true</c> if the server cleans up the inactive WebSocket service instances every 60 seconds;
/// otherwise, <c>false</c>. The default value is <c>true</c>.
/// </value>
public IEnumerable<string> ServicePaths {
public bool KeepClean {
get {
var url = BaseUri.IsAbsoluteUri
? BaseUri.ToString().TrimEnd('/')
: String.Empty;
return _svcHosts.KeepClean;
}
foreach (var path in _svcHosts.Paths)
yield return url + path;
set {
_svcHosts.KeepClean = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether the server cleans up the inactive WebSocket service
/// instances periodically.
/// Gets the collection of paths associated with the every WebSocket services that the server provides.
/// </summary>
/// <value>
/// <c>true</c> if the server cleans up the inactive WebSocket service instances every 60 seconds;
/// otherwise, <c>false</c>. The default value is <c>true</c>.
/// An IEnumerable&lt;string&gt; that contains the collection of paths.
/// </value>
public bool Sweeping {
public IEnumerable<string> ServicePaths {
get {
return _svcHosts.Sweeping;
}
var url = BaseUri.IsAbsoluteUri
? BaseUri.ToString().TrimEnd('/')
: String.Empty;
set {
_svcHosts.Sweeping = value;
foreach (var path in _svcHosts.Paths)
yield return url + path;
}
}
@ -238,8 +238,8 @@ namespace WebSocketSharp.Server {
? new Uri(BaseUri, absPath)
: absPath.ToUri();
if (!Sweeping)
svcHost.Sweeping = false;
if (!KeepClean)
svcHost.KeepClean = false;
_svcHosts.Add(absPath, svcHost);
}

@ -191,13 +191,13 @@ namespace WebSocketSharp.Server {
/// <c>true</c> if the server cleans up the inactive WebSocket service instances every 60 seconds;
/// otherwise, <c>false</c>. The default value is <c>true</c>.
/// </value>
public bool Sweeping {
public bool KeepClean {
get {
return _sessions.Sweeping;
return _sessions.KeepClean;
}
set {
_sessions.Sweeping = value;
_sessions.KeepClean = value;
}
}

@ -138,10 +138,10 @@ namespace WebSocketSharp.Server
/// the inactive <see cref="WebSocketService"/> instances periodically.
/// </summary>
/// <value>
/// <c>true</c> if the <see cref="WebSocketServiceManager"/> cleans up
/// the inactive <see cref="WebSocketService"/> instances every 60 seconds; otherwise, <c>false</c>.
/// <c>true</c> if the <see cref="WebSocketServiceManager"/> cleans up the inactive
/// <see cref="WebSocketService"/> instances every 60 seconds; otherwise, <c>false</c>.
/// </value>
public bool Sweeping {
public bool KeepClean {
get {
return _sweepTimer.Enabled;
}

Loading…
Cancel
Save