Boost logo

Boost :

Subject: Re: [boost] [asio] buffered_read_stream issue, with async_read()
From: brad higgins (bhiggins_at_[hidden])
Date: 2009-06-05 09:25:18


Hi Michael,

> Perhaps you can consider changing your completion routine for the
> header
> read. If the header indicates that the body is 0 bytes then there
> is no need to read a body. Simply read the next header.

That would certainly fix the issue, and is what I have done in my
program. I was raising the issue here, however, to see if people
thought this was a bug in the implementation of buffered_read_stream.
It is an edge case, which occurs only when attempting a 0-byte read
AND when there are no bytes available to be read from the socket. If
there is more data to be read, 0-byte reads are handled immediately
and successfully. In addition, the behavior is different from issuing
0 byte reads on the tcp::socket directly. Apart from this issue, I
was able to wrap the tcp::socket with the buffered_read_stream
seamlessly.

Do you think I have found a bug, or are 0-byte reads always to be
avoided?

Thanks,
Brad


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk