{
}
- ~implementation()
+ void stop()
{
try
{
acceptor_.cancel();
acceptor_.close();
}
- catch(...)
+ catch (...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
}
+ }
+
+ ~implementation()
+ {
auto conns_set = connection_set_;
service_->post([conns_set]
void start_accept()
{
spl::shared_ptr<tcp::socket> socket(new tcp::socket(*service_));
- acceptor_.async_accept(*socket, std::bind(&implementation::handle_accept, this, socket, std::placeholders::_1));
+ acceptor_.async_accept(*socket, std::bind(&implementation::handle_accept, shared_from_this(), socket, std::placeholders::_1));
}
void handle_accept(const spl::shared_ptr<tcp::socket>& socket, const boost::system::error_code& error)
impl_->start_accept();
}
-AsyncEventServer::~AsyncEventServer() {}
+AsyncEventServer::~AsyncEventServer()
+{
+ impl_->stop();
+}
+
void AsyncEventServer::add_client_lifecycle_object_factory(const lifecycle_factory_t& factory) { impl_->add_client_lifecycle_object_factory(factory); }
}}
#include <common/memory.h>
#include <boost/asio.hpp>
+#include <boost/noncopyable.hpp>
namespace caspar { namespace IO {
typedef std::function<std::pair<std::wstring, std::shared_ptr<void>> (const std::string& ipv4_address)>
lifecycle_factory_t;
-class AsyncEventServer
+class AsyncEventServer : boost::noncopyable
{
public:
explicit AsyncEventServer(