Boost logo

Boost :

Subject: Re: [boost] async_read SEGFAULT
From: Richard Hodges (hodges.r_at_[hidden])
Date: 2019-01-07 01:39:20


Controlling the streambuf's lifetime with a shared pointer is probably an
error.

The buffer will need to live as long as the socket lives. It will contain
extra data after each async_read which you will want to preserve.

I would suggest that it's a member owned by the connection object, in the
same way that the socket is

On Sun, 6 Jan 2019, 09:08 hh h via Boost <boost_at_[hidden] wrote:

> Thanks Richard, that was well explained, I am now thinking to have a
> class to wrap the shared_ptr<boost::asion::streambuf> to lock it down
> during calling the async_xxx until it is back to the handler function
> then to release it.
>
> Thank you so much Richard.
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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