Skip to content

Commit df2726c

Browse files
committed
Renamed the Sweeping property to the KeepClean property
1 parent ef17cab commit df2726c

File tree

8 files changed

+66
-66
lines changed

8 files changed

+66
-66
lines changed

Example2/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static void Main (string [] args)
2626
#if DEBUG
2727
wssv.Log.Level = LogLevel.TRACE;
2828
#endif
29-
//wssv.Sweeping = false;
29+
//wssv.KeepClean = false;
3030
3131
wssv.Start ();
3232
Console.WriteLine (
@@ -45,7 +45,7 @@ public static void Main (string [] args)
4545
//var file = ConfigurationManager.AppSettings ["ServerCertFile"];
4646
//var password = ConfigurationManager.AppSettings ["CertFilePassword"];
4747
//wssv.Certificate = new X509Certificate2 (file, password);
48-
//wssv.Sweeping = false;
48+
//wssv.KeepClean = false;
4949
wssv.AddWebSocketService<Echo> ("/Echo");
5050
wssv.AddWebSocketService<Chat> ("/Chat");
5151
//wssv.AddWebSocketService<Echo> ("/エコー");

Example3/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static void Main (string [] args)
1717
_httpsv.Log.Level = LogLevel.TRACE;
1818
#endif
1919
_httpsv.RootPath = ConfigurationManager.AppSettings ["RootPath"];
20-
//_httpsv.Sweeping = false;
20+
//_httpsv.KeepClean = false;
2121
_httpsv.AddWebSocketService<Echo> ("/Echo");
2222
_httpsv.AddWebSocketService<Chat> ("/Chat");
2323

websocket-sharp/Server/HttpServer.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,24 @@ public bool IsListening {
9696
}
9797
}
9898

99+
/// <summary>
100+
/// Gets or sets a value indicating whether the server cleans up the inactive WebSocket service
101+
/// instances periodically.
102+
/// </summary>
103+
/// <value>
104+
/// <c>true</c> if the server cleans up the inactive WebSocket service instances every 60 seconds;
105+
/// otherwise, <c>false</c>. The default value is <c>true</c>.
106+
/// </value>
107+
public bool KeepClean {
108+
get {
109+
return _svcHosts.KeepClean;
110+
}
111+
112+
set {
113+
_svcHosts.KeepClean = value;
114+
}
115+
}
116+
99117
/// <summary>
100118
/// Gets the logging functions.
101119
/// </summary>
@@ -155,24 +173,6 @@ public IEnumerable<string> ServicePaths {
155173
}
156174
}
157175

158-
/// <summary>
159-
/// Gets or sets a value indicating whether the server cleans up the inactive WebSocket service
160-
/// instances periodically.
161-
/// </summary>
162-
/// <value>
163-
/// <c>true</c> if the server cleans up the inactive WebSocket service instances every 60 seconds;
164-
/// otherwise, <c>false</c>. The default value is <c>true</c>.
165-
/// </value>
166-
public bool Sweeping {
167-
get {
168-
return _svcHosts.Sweeping;
169-
}
170-
171-
set {
172-
_svcHosts.Sweeping = value;
173-
}
174-
}
175-
176176
#endregion
177177

178178
#region Public Events
@@ -412,8 +412,8 @@ public void AddWebSocketService<T> (string absPath)
412412

413413
var svcHost = new WebSocketServiceHost<T> (_logger);
414414
svcHost.Uri = absPath.ToUri ();
415-
if (!Sweeping)
416-
svcHost.Sweeping = false;
415+
if (!KeepClean)
416+
svcHost.KeepClean = false;
417417

418418
_svcHosts.Add (absPath, svcHost);
419419
}

websocket-sharp/Server/IServiceHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public interface IServiceHost {
4646
/// <c>true</c> if the WebSocket service host cleans up the inactive service instances periodically;
4747
/// otherwise, <c>false</c>.
4848
/// </value>
49-
bool Sweeping { get; set; }
49+
bool KeepClean { get; set; }
5050

5151
/// <summary>
5252
/// Binds the specified <see cref="WebSocketContext"/> to a <see cref="WebSocketService"/> instance.

websocket-sharp/Server/ServiceHostManager.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ internal class ServiceHostManager {
3535

3636
#region Private Fields
3737

38+
private bool _keepClean;
3839
private Dictionary<string, IServiceHost> _svcHosts;
39-
private bool _sweeping;
4040

4141
#endregion
4242

4343
#region Public Constructors
4444

4545
public ServiceHostManager()
4646
{
47+
_keepClean = true;
4748
_svcHosts = new Dictionary<string, IServiceHost>();
48-
_sweeping = true;
4949
}
5050

5151
#endregion
@@ -58,30 +58,30 @@ public int Count {
5858
}
5959
}
6060

61-
public IEnumerable<string> Paths {
61+
public bool KeepClean {
6262
get {
63-
return _svcHosts.Keys;
63+
return _keepClean;
6464
}
65-
}
6665

67-
public IEnumerable<IServiceHost> ServiceHosts {
68-
get {
69-
return _svcHosts.Values;
66+
set {
67+
if (_keepClean ^ value)
68+
{
69+
_keepClean = value;
70+
foreach (var svcHost in _svcHosts.Values)
71+
svcHost.KeepClean = value;
72+
}
7073
}
7174
}
7275

73-
public bool Sweeping {
76+
public IEnumerable<string> Paths {
7477
get {
75-
return _sweeping;
78+
return _svcHosts.Keys;
7679
}
80+
}
7781

78-
set {
79-
if (_sweeping ^ value)
80-
{
81-
_sweeping = value;
82-
foreach (var svcHost in _svcHosts.Values)
83-
svcHost.Sweeping = value;
84-
}
82+
public IEnumerable<IServiceHost> ServiceHosts {
83+
get {
84+
return _svcHosts.Values;
8585
}
8686
}
8787

websocket-sharp/Server/WebSocketServer.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -145,37 +145,37 @@ public WebSocketServer(System.Net.IPAddress address, int port, bool secure)
145145
#region Public Properties
146146

147147
/// <summary>
148-
/// Gets the collection of paths associated with the every WebSocket services that the server provides.
148+
/// Gets or sets a value indicating whether the server cleans up the inactive WebSocket service
149+
/// instances periodically.
149150
/// </summary>
150151
/// <value>
151-
/// An IEnumerable&lt;string&gt; that contains the collection of paths.
152+
/// <c>true</c> if the server cleans up the inactive WebSocket service instances every 60 seconds;
153+
/// otherwise, <c>false</c>. The default value is <c>true</c>.
152154
/// </value>
153-
public IEnumerable<string> ServicePaths {
155+
public bool KeepClean {
154156
get {
155-
var url = BaseUri.IsAbsoluteUri
156-
? BaseUri.ToString().TrimEnd('/')
157-
: String.Empty;
157+
return _svcHosts.KeepClean;
158+
}
158159

159-
foreach (var path in _svcHosts.Paths)
160-
yield return url + path;
160+
set {
161+
_svcHosts.KeepClean = value;
161162
}
162163
}
163164

164165
/// <summary>
165-
/// Gets or sets a value indicating whether the server cleans up the inactive WebSocket service
166-
/// instances periodically.
166+
/// Gets the collection of paths associated with the every WebSocket services that the server provides.
167167
/// </summary>
168168
/// <value>
169-
/// <c>true</c> if the server cleans up the inactive WebSocket service instances every 60 seconds;
170-
/// otherwise, <c>false</c>. The default value is <c>true</c>.
169+
/// An IEnumerable&lt;string&gt; that contains the collection of paths.
171170
/// </value>
172-
public bool Sweeping {
171+
public IEnumerable<string> ServicePaths {
173172
get {
174-
return _svcHosts.Sweeping;
175-
}
173+
var url = BaseUri.IsAbsoluteUri
174+
? BaseUri.ToString().TrimEnd('/')
175+
: String.Empty;
176176

177-
set {
178-
_svcHosts.Sweeping = value;
177+
foreach (var path in _svcHosts.Paths)
178+
yield return url + path;
179179
}
180180
}
181181

@@ -238,8 +238,8 @@ public void AddWebSocketService<T>(string absPath)
238238
? new Uri(BaseUri, absPath)
239239
: absPath.ToUri();
240240

241-
if (!Sweeping)
242-
svcHost.Sweeping = false;
241+
if (!KeepClean)
242+
svcHost.KeepClean = false;
243243

244244
_svcHosts.Add(absPath, svcHost);
245245
}

websocket-sharp/Server/WebSocketServiceHost.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ public WebSocketServiceHost(System.Net.IPAddress address, int port, string absPa
191191
/// <c>true</c> if the server cleans up the inactive WebSocket service instances every 60 seconds;
192192
/// otherwise, <c>false</c>. The default value is <c>true</c>.
193193
/// </value>
194-
public bool Sweeping {
194+
public bool KeepClean {
195195
get {
196-
return _sessions.Sweeping;
196+
return _sessions.KeepClean;
197197
}
198198

199199
set {
200-
_sessions.Sweeping = value;
200+
_sessions.KeepClean = value;
201201
}
202202
}
203203

websocket-sharp/Server/WebSocketServiceManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ public IEnumerable<string> InactiveIDs {
138138
/// the inactive <see cref="WebSocketService"/> instances periodically.
139139
/// </summary>
140140
/// <value>
141-
/// <c>true</c> if the <see cref="WebSocketServiceManager"/> cleans up
142-
/// the inactive <see cref="WebSocketService"/> instances every 60 seconds; otherwise, <c>false</c>.
141+
/// <c>true</c> if the <see cref="WebSocketServiceManager"/> cleans up the inactive
142+
/// <see cref="WebSocketService"/> instances every 60 seconds; otherwise, <c>false</c>.
143143
/// </value>
144-
public bool Sweeping {
144+
public bool KeepClean {
145145
get {
146146
return _sweepTimer.Enabled;
147147
}

0 commit comments

Comments
 (0)