diff --git a/websocket-sharp/Net/HttpListenerAsyncResult.cs b/websocket-sharp/Net/HttpListenerAsyncResult.cs index a747da0a..cee32c5e 100644 --- a/websocket-sharp/Net/HttpListenerAsyncResult.cs +++ b/websocket-sharp/Net/HttpListenerAsyncResult.cs @@ -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;