Boost logo

Boost Users :

Subject: Re: [Boost-users] [Asio]What's the behavior of socket.async_write()after socket.close() is called?
From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2010-06-07 07:32:07


On Mon, Jun 7, 2010 at 8:03 AM, Igor R <boost.lists_at_[hidden]> wrote:
>> It seems to me. If you call close you want the socket released. That a
>> zombie socket remains is a design problem. Zombie objects should be avoided.
>
> Why is it more zombie, than a fresh "unopened" socket?

It is not. A open function is also bad. Two-phase construction is not
well seen, and with reason. They loosen the classes invariant and make
reasoning harder.

>> Also, the destructor guarantees to cancel any pending asynchronous operation AFAIK.
>
> As far as I can see, it doesn't.
> shutdown() does.

IIRC, the destructor calls shutdown. But I can't see any documentation
for tcp::socket destructor.
Maybe Christopher could shed us some light in this. I hope it is just
an overlook. Obligating everybody to call shutdown before destroying a
socket with pending asynchronous operations seems dangerous to me.

Regards,

-- 
Felipe Magno de Almeida

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