Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] Connection not ending
From: Markus Bonk (markus_bonk_at_[hidden])
Date: 2012-05-10 10:48:19


Thanks Igor

"Igor R" wrote in message
news:CAPnv1PKnkw=8P7EUhatC5qo=TEaBmrLFF+k_XYSkDmQ3QMV8QQ_at_mail.gmail.com...

> I am still not there yet. To close the socket I need to keep a
> reference/shared_ptr to the connection somewhere. Which basically means I
> have two shared_ptrs. If a handler reports an error the connection needs
> to
> know something about the manager/state machine/whatever to tell it it is
> closing down, right?

Yes, right.
Well, if you're speaking of "http server 3" specifically, you have to
change its design a bit. Eg., you can add to the server class
something like vector<weak_ptr<connection> > connections_ member, and
push there every new_connectio_ -- to get an ability of managing
connections. Of course, you have to garbage-collect expired weak-ptrs
sometimes, eg. when a new connection is added or on some other
event...


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