[Fix] Check if can add a connection
This commit is contained in:
parent
afd6191331
commit
c9511823b8
@ -294,7 +294,11 @@ namespace WebSocketSharp.Net
|
||||
var lsnr = conn._context.Listener;
|
||||
if (conn._lastListener != lsnr) {
|
||||
conn.removeConnection ();
|
||||
lsnr.AddConnection (conn);
|
||||
if (!lsnr.AddConnection (conn)) {
|
||||
conn.close ();
|
||||
return;
|
||||
}
|
||||
|
||||
conn._lastListener = lsnr;
|
||||
}
|
||||
|
||||
|
@ -503,10 +503,19 @@ namespace WebSocketSharp.Net
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
internal void AddConnection (HttpConnection connection)
|
||||
internal bool AddConnection (HttpConnection connection)
|
||||
{
|
||||
lock (_connectionsSync)
|
||||
if (!_listening)
|
||||
return false;
|
||||
|
||||
lock (_connectionsSync) {
|
||||
if (!_listening)
|
||||
return false;
|
||||
|
||||
_connections[connection] = connection;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
internal bool Authenticate (HttpListenerContext context)
|
||||
|
Loading…
Reference in New Issue
Block a user