[Modify] Polish it
This commit is contained in:
parent
95c13ace79
commit
237c500d6b
@ -183,22 +183,31 @@ namespace WebSocketSharp.Net
|
|||||||
|
|
||||||
public override int EndRead (IAsyncResult asyncResult)
|
public override int EndRead (IAsyncResult asyncResult)
|
||||||
{
|
{
|
||||||
if (_disposed)
|
if (_disposed) {
|
||||||
throw new ObjectDisposedException (GetType ().ToString ());
|
var name = GetType ().ToString ();
|
||||||
|
|
||||||
|
throw new ObjectDisposedException (name);
|
||||||
|
}
|
||||||
|
|
||||||
if (asyncResult == null)
|
if (asyncResult == null)
|
||||||
throw new ArgumentNullException ("asyncResult");
|
throw new ArgumentNullException ("asyncResult");
|
||||||
|
|
||||||
var ares = asyncResult as HttpStreamAsyncResult;
|
var ares = asyncResult as HttpStreamAsyncResult;
|
||||||
|
|
||||||
if (ares == null)
|
if (ares == null) {
|
||||||
throw new ArgumentException ("A wrong IAsyncResult.", "asyncResult");
|
var msg = "A wrong IAsyncResult instance.";
|
||||||
|
|
||||||
|
throw new ArgumentException (msg, "asyncResult");
|
||||||
|
}
|
||||||
|
|
||||||
if (!ares.IsCompleted)
|
if (!ares.IsCompleted)
|
||||||
ares.AsyncWaitHandle.WaitOne ();
|
ares.AsyncWaitHandle.WaitOne ();
|
||||||
|
|
||||||
if (ares.HasException)
|
if (ares.HasException) {
|
||||||
throw new HttpListenerException (400, "I/O operation aborted.");
|
var msg = "I/O operation aborted.";
|
||||||
|
|
||||||
|
throw new HttpListenerException (400, msg);
|
||||||
|
}
|
||||||
|
|
||||||
return ares.Count;
|
return ares.Count;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user