[Modify] Polish it
This commit is contained in:
parent
596237e0c7
commit
c122e2dc72
@ -460,14 +460,12 @@ namespace WebSocketSharp.Net
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<HttpListenerPrefix> prefs, prefs2;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
prefs = _prefixes;
|
current = _prefixes;
|
||||||
var idx = prefs.IndexOf (prefix);
|
var idx = current.IndexOf (prefix);
|
||||||
|
|
||||||
if (idx > -1) {
|
if (idx > -1) {
|
||||||
if (prefs[idx].Listener != prefix.Listener) {
|
if (current[idx].Listener != prefix.Listener) {
|
||||||
var msg = String.Format (
|
var msg = String.Format (
|
||||||
"There is another listener for {0}.", prefix
|
"There is another listener for {0}.", prefix
|
||||||
);
|
);
|
||||||
@ -478,11 +476,11 @@ namespace WebSocketSharp.Net
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
prefs2 = new List<HttpListenerPrefix> (prefs);
|
future = new List<HttpListenerPrefix> (current);
|
||||||
prefs2.Add (prefix);
|
future.Add (prefix);
|
||||||
}
|
}
|
||||||
while (
|
while (
|
||||||
Interlocked.CompareExchange (ref _prefixes, prefs2, prefs) != prefs
|
Interlocked.CompareExchange (ref _prefixes, future, current) != current
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user