// return value indicates sync vs async completion
// false: sync completion
- // true: async completion
+ // true: async completion or error
private unsafe bool ReadAsyncFast(HttpListenerAsyncEventArgs eventArgs)
{
if (NetEventSource.IsEnabled)
eventArgs.StartOperationReceive();
uint statusCode = 0;
- bool completedAsynchronously = false;
+ bool completedAsynchronouslyOrWithError = false;
try
{
Debug.Assert(eventArgs.Buffer != null, "'BufferList' is not supported for read operations.");
// IO operation completed synchronously. No IO completion port callback is used because
// it was disabled in SwitchToOpaqueMode()
eventArgs.FinishOperationSuccess((int)bytesReturned, true);
- completedAsynchronously = false;
+ completedAsynchronouslyOrWithError = false;
}
else
{
- completedAsynchronously = true;
+ completedAsynchronouslyOrWithError = true;
}
}
catch (Exception e)
_outputStream.SetClosedFlag();
_outputStream.InternalHttpContext.Abort();
- throw;
+ completedAsynchronouslyOrWithError = true;
}
finally
{
if (NetEventSource.IsEnabled)
{
- NetEventSource.Exit(this, completedAsynchronously);
+ NetEventSource.Exit(this, completedAsynchronouslyOrWithError);
}
}
- return completedAsynchronously;
+ return completedAsynchronouslyOrWithError;
}
public override int ReadByte()
// return value indicates sync vs async completion
// false: sync completion
- // true: async completion
+ // true: async completion or with error
private unsafe bool WriteAsyncFast(HttpListenerAsyncEventArgs eventArgs)
{
if (NetEventSource.IsEnabled)
eventArgs.StartOperationSend();
uint statusCode;
- bool completedAsynchronously = false;
+ bool completedAsynchronouslyOrWithError = false;
try
{
if (_outputStream.Closed ||
{
// IO operation completed synchronously - callback won't be called to signal completion.
eventArgs.FinishOperationSuccess((int)bytesSent, true);
- completedAsynchronously = false;
+ completedAsynchronouslyOrWithError = false;
}
else
{
- completedAsynchronously = true;
+ completedAsynchronouslyOrWithError = true;
}
}
catch (Exception e)
_outputStream.SetClosedFlag();
_outputStream.InternalHttpContext.Abort();
- throw;
+ completedAsynchronouslyOrWithError = true;
}
finally
{
if (NetEventSource.IsEnabled)
{
- NetEventSource.Exit(this, completedAsynchronously);
+ NetEventSource.Exit(this, completedAsynchronouslyOrWithError);
}
}
- return completedAsynchronously;
+ return completedAsynchronouslyOrWithError;
}
public override void WriteByte(byte value)