[Modify] Use the Queue<T> class instead
This commit is contained in:
parent
3c9daa9bb0
commit
c761dc4c6f
@ -66,7 +66,7 @@ namespace WebSocketSharp.Net
|
|||||||
private string _certFolderPath;
|
private string _certFolderPath;
|
||||||
private Dictionary<HttpConnection, HttpConnection> _connections;
|
private Dictionary<HttpConnection, HttpConnection> _connections;
|
||||||
private object _connectionsSync;
|
private object _connectionsSync;
|
||||||
private List<HttpListenerContext> _contextQueue;
|
private Queue<HttpListenerContext> _contextQueue;
|
||||||
private object _contextQueueSync;
|
private object _contextQueueSync;
|
||||||
private LinkedList<HttpListenerContext> _contextRegistry;
|
private LinkedList<HttpListenerContext> _contextRegistry;
|
||||||
private object _contextRegistrySync;
|
private object _contextRegistrySync;
|
||||||
@ -106,7 +106,7 @@ namespace WebSocketSharp.Net
|
|||||||
_connections = new Dictionary<HttpConnection, HttpConnection> ();
|
_connections = new Dictionary<HttpConnection, HttpConnection> ();
|
||||||
_connectionsSync = ((ICollection) _connections).SyncRoot;
|
_connectionsSync = ((ICollection) _connections).SyncRoot;
|
||||||
|
|
||||||
_contextQueue = new List<HttpListenerContext> ();
|
_contextQueue = new Queue<HttpListenerContext> ();
|
||||||
_contextQueueSync = ((ICollection) _contextQueue).SyncRoot;
|
_contextQueueSync = ((ICollection) _contextQueue).SyncRoot;
|
||||||
|
|
||||||
_contextRegistry = new LinkedList<HttpListenerContext> ();
|
_contextRegistry = new LinkedList<HttpListenerContext> ();
|
||||||
@ -533,11 +533,7 @@ namespace WebSocketSharp.Net
|
|||||||
if (_contextQueue.Count == 0)
|
if (_contextQueue.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var ret = _contextQueue[0];
|
return _contextQueue.Dequeue ();
|
||||||
|
|
||||||
_contextQueue.RemoveAt (0);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -610,7 +606,7 @@ namespace WebSocketSharp.Net
|
|||||||
var ares = getAsyncResultFromQueue ();
|
var ares = getAsyncResultFromQueue ();
|
||||||
|
|
||||||
if (ares == null)
|
if (ares == null)
|
||||||
_contextQueue.Add (context);
|
_contextQueue.Enqueue (context);
|
||||||
else
|
else
|
||||||
ares.Complete (context);
|
ares.Complete (context);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user