Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] strange behaviour on android
From: Igor R (boost.lists_at_[hidden])
Date: 2010-11-24 16:20:06


> I understand that I add data to the streambuf, while async_write is in
> progress, but it's done in the same thread, and seems to be legitimate.

Well, after a more close look at the implementation of streambuf, I
realized that this was absolutely invalid approach.
When async_write() gets streamuf, its data() (actually a pointer to
an element of std::vector) is passed to the underlying implementation.
>From this point, any additional data put into the streambuf, might
cause a resizing of the underlying std::vector, and such a resize
invalidates the ptr previously returned from data().
I really don't understand why it never fails on Windows. Maybe just
because WSASend works very quickly :).


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net