Boost logo

Boost :

Subject: Re: [boost] [asio] boost::asio::read with empty input vector leads to an infinite loop
From: Michael Kochetkov (michael.kv_at_[hidden])
Date: 2012-07-13 17:33:19


> On Fri, Jul 13, 2012 at 2:19 PM, Michael Kochetkov <michael.kv_at_[hidden]>
> wrote:
> > I would prefer a error message or crash because it is logically to
suppose
> > the asio would resize the vector or emit a error because it cannot
handle
> > situation properly (IMO). The concern behind the issue is working time
and
> > money -- it is really tricky for inexperienced boost users to figure out
the
> > culprit of the behavior. The program does not crash, it reports no
errors
> > and it just does not work.
> >
>
> It seems like the documentation already addresses both of these questions.
>
> For boost::asio::read() it says "The call will block until one of the
> following conditions is true: 1) The supplied buffers are full. That
> is, the bytes transferred is equal to the sum of the buffer sizes..."
Ok. Thank you. I have considered this explanation but infinite loop confused
me so I have decided to get an "official" opinion. We will try to be alerted
to the issue.

> As for supposing that the buffer might resize the vector for you, ASIO
> has no idea (for example) how large you'd be willing to let it grow.
This is OK too. Though I bet the total majority of asio customers have to
solve resizing problem somehow. I will probably add the total data size to
the serialization protocol and wrap boost::asio::read function.

--
Michael Kochetkov

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