-
Notifications
You must be signed in to change notification settings - Fork 40
Conversation
@@ -111,6 +112,10 @@ private void ValidateReadBuffer(byte[] buffer, int offset, int size) | |||
|
|||
public override unsafe int Read([In, Out] byte[] buffer, int offset, int size) | |||
{ | |||
if (!RequestContext.AllowSynchronousIO) | |||
{ | |||
throw new InvalidOperationException("Syncronous IO APIs are disabled, see AllowSynchronousIO."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synchronous
@@ -91,10 +91,16 @@ public override long Position | |||
// Send headers | |||
public override void Flush() | |||
{ | |||
if (!RequestContext.AllowSynchronousIO) | |||
{ | |||
throw new InvalidOperationException("Syncronous IO APIs are disabled, see AllowSynchronousIO."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synchronous
@@ -449,9 +455,15 @@ private HttpApi.HTTP_FLAGS ComputeLeftToWrite(long writeCount, bool endOfRequest | |||
|
|||
public override void Write(byte[] buffer, int offset, int count) | |||
{ | |||
if (!RequestContext.AllowSynchronousIO) | |||
{ | |||
throw new InvalidOperationException("Syncronous IO APIs are disabled, see AllowSynchronousIO."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synchronous
27a9e61
to
bbc7620
Compare
0c1f285
to
b2eaf80
Compare
Updated to enable sync by default. |
if (!RequestContext.AllowSynchronousIO) | ||
{ | ||
throw new InvalidOperationException("Synchronous IO APIs are disabled, see AllowSynchronousIO."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: newline.
} | ||
} | ||
|
||
[ConditionalFact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, where is the condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public async Task RequestBody_ReadSync_Success() | ||
{ | ||
string address; | ||
using (var server = Utilities.CreateHttpServer(out address)) | ||
{ | ||
Task<string> responseTask = SendRequestAsync(address, "Hello World"); | ||
|
||
server.Options.AllowSynchronousIO = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these lines in your tests still necessary now the true is the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at the moment, but they will be when we switch the default and since I had already fixed them there was no point in reverting it.
#366 Read, Write, and Flush now throw by default. There's some debate on Flush because it breaks StreamWriter.Dispose().