Skip to content

Commit 928fd07

Browse files
committed
[Modify] Polish it
1 parent 526fb63 commit 928fd07

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

websocket-sharp/Net/HttpListener.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -412,19 +412,18 @@ public Func<IIdentity, NetworkCredential> UserCredentialsFinder {
412412

413413
private void cleanupContextQueue (bool sendServiceUnavailable)
414414
{
415-
HttpListenerContext[] ctxs = null;
416-
417-
lock (_contextQueueSync) {
418-
if (_contextQueue.Count == 0)
419-
return;
420-
421-
ctxs = _contextQueue.ToArray ();
415+
if (_contextQueue.Count == 0)
416+
return;
422417

418+
if (!sendServiceUnavailable) {
423419
_contextQueue.Clear ();
424-
}
425420

426-
if (!sendServiceUnavailable)
427421
return;
422+
}
423+
424+
var ctxs = _contextQueue.ToArray ();
425+
426+
_contextQueue.Clear ();
428427

429428
foreach (var ctx in ctxs) {
430429
ctx.ErrorStatusCode = 503;

0 commit comments

Comments
 (0)