A vibe.d thing
Steven Schveighoffer
schveiguy at gmail.com
Fri Jul 27 19:25:55 UTC 2018
On 7/27/18 3:18 PM, Steven Schveighoffer wrote:
> On 7/27/18 3:02 PM, Russel Winder wrote:
>> I have posted to the vibe.d forum, but I hate forums, and it looks like
>> a months worth of questions haven't been read yet, so please excuse
>> repeating here – I need an fairly definitive answer pdq in order to
>> finish my answer to the CVu Code Critique 112. The deadline is in three
>> days.
>>
>> http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/
>> 57605/
>>
>>
>> cf. https://vibed.org/api/vibe.core.stream/InputStream.read
>>
>> ubyte[256] buffer;
>> auto n = req.bodyReader.read(buffer, IOMode.once);
>>
>> appears to work fine as long as there are 256 ubytes to read. If
>> however the end of stream means there are less than 256 ubytes
>> available then an exception is thrown.
>>
>> At first sight this seems inconsistent with the read returning the
>> number of ubytes read.
>>
>> Or am I missing something?
>>
>
> Maybe IOMode.immediate or .once?
> https://vibed.org/api/eventcore.driver/IOMode
Oh, it looks like you specified once. Hm... that seems to me like it
should work.
Looks like IOMode is ignored:
https://github.com/vibe-d/vibe.d/blob/a9589d955f10bd076a67d47ace0c78cfd3aa8246/core/vibe/core/drivers/libevent2_tcp.d#L285
So, no, there isn't a correct way to do this, it's unimplemented.
-Steve
More information about the Digitalmars-d-learn
mailing list