|
|
|
@ -105,30 +105,41 @@ namespace WebSocketSharp.Net
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Internal Methods
|
|
|
|
#region Private Methods
|
|
|
|
|
|
|
|
|
|
|
|
internal void Complete (Exception exception)
|
|
|
|
private static void complete (ListenerAsyncResult asyncResult)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_exception = InGet && (exception is ObjectDisposedException)
|
|
|
|
asyncResult._completed = true;
|
|
|
|
? new HttpListenerException (500, "Listener closed.")
|
|
|
|
|
|
|
|
: exception;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lock (_sync) {
|
|
|
|
var waitHandle = asyncResult._waitHandle;
|
|
|
|
_completed = true;
|
|
|
|
if (waitHandle != null)
|
|
|
|
if (_waitHandle != null)
|
|
|
|
waitHandle.Set ();
|
|
|
|
_waitHandle.Set ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_callback != null)
|
|
|
|
var callback = asyncResult._callback;
|
|
|
|
|
|
|
|
if (callback != null)
|
|
|
|
ThreadPool.UnsafeQueueUserWorkItem (
|
|
|
|
ThreadPool.UnsafeQueueUserWorkItem (
|
|
|
|
state => {
|
|
|
|
state => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
_callback (this);
|
|
|
|
callback (asyncResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch {
|
|
|
|
catch {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
null);
|
|
|
|
null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Internal Methods
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal void Complete (Exception exception)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_exception = InGet && (exception is ObjectDisposedException)
|
|
|
|
|
|
|
|
? new HttpListenerException (500, "Listener closed.")
|
|
|
|
|
|
|
|
: exception;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lock (_sync)
|
|
|
|
|
|
|
|
complete (this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal void Complete (HttpListenerContext context)
|
|
|
|
internal void Complete (HttpListenerContext context)
|
|
|
|
@ -169,22 +180,8 @@ namespace WebSocketSharp.Net
|
|
|
|
_context = context;
|
|
|
|
_context = context;
|
|
|
|
_syncCompleted = syncCompleted;
|
|
|
|
_syncCompleted = syncCompleted;
|
|
|
|
|
|
|
|
|
|
|
|
lock (_sync) {
|
|
|
|
lock (_sync)
|
|
|
|
_completed = true;
|
|
|
|
complete (this);
|
|
|
|
if (_waitHandle != null)
|
|
|
|
|
|
|
|
_waitHandle.Set ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_callback != null)
|
|
|
|
|
|
|
|
ThreadPool.UnsafeQueueUserWorkItem (
|
|
|
|
|
|
|
|
state => {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
_callback (this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal HttpListenerContext GetContext ()
|
|
|
|
internal HttpListenerContext GetContext ()
|
|
|
|
|