Refactored a few for HttpListenerAsyncResult.cs

This commit is contained in:
sta 2015-05-14 16:55:53 +09:00
parent cafac4ebc5
commit 9efcbbe960

View File

@ -50,7 +50,9 @@ namespace WebSocketSharp.Net
private AsyncCallback _callback;
private bool _completed;
private HttpListenerContext _context;
private bool _endCalled;
private Exception _exception;
private bool _inGet;
private object _state;
private object _sync;
private bool _syncCompleted;
@ -58,16 +60,9 @@ namespace WebSocketSharp.Net
#endregion
#region Internal Fields
#region Internal Constructors
internal bool EndCalled;
internal bool InGet;
#endregion
#region Public Constructors
public HttpListenerAsyncResult (AsyncCallback callback, object state)
internal HttpListenerAsyncResult (AsyncCallback callback, object state)
{
_callback = callback;
_state = state;
@ -76,6 +71,30 @@ namespace WebSocketSharp.Net
#endregion
#region Internal Properties
internal bool EndCalled {
get {
return _endCalled;
}
set {
_endCalled = value;
}
}
internal bool InGet {
get {
return _inGet;
}
set {
_inGet = value;
}
}
#endregion
#region Public Properties
public object AsyncState {
@ -135,7 +154,7 @@ namespace WebSocketSharp.Net
internal void Complete (Exception exception)
{
_exception = InGet && (exception is ObjectDisposedException)
_exception = _inGet && (exception is ObjectDisposedException)
? new HttpListenerException (500, "Listener closed.")
: exception;