From 7e7ef09558efdd89c3168017592978e90531f76d Mon Sep 17 00:00:00 2001 From: Helge Norberg Date: Wed, 13 Jul 2016 13:03:39 +0200 Subject: [PATCH] Enabled TCP keep alive on TCP connections to clients. This might help in discovering that a client has ungracefully disconnected. In that case the OSC subscription will also end, causing the server not to try to send OSC packages to a client that is down. This fix relates a little bit to #313, but is more from the server's point of view. --- protocol/util/AsyncEventServer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/protocol/util/AsyncEventServer.cpp b/protocol/util/AsyncEventServer.cpp index 8348c56b9..d404becdb 100644 --- a/protocol/util/AsyncEventServer.cpp +++ b/protocol/util/AsyncEventServer.cpp @@ -329,6 +329,12 @@ struct AsyncEventServer::implementation : public spl::enable_shared_from_thisset_option(boost::asio::socket_base::keep_alive(true), ec); + + if (ec) + CASPAR_LOG(warning) << print() << L" Failed to enable TCP keep-alive on socket"; + auto conn = connection::create(service_, socket, protocol_factory_, connection_set_); connection_set_->insert(conn); @@ -341,6 +347,11 @@ struct AsyncEventServer::implementation : public spl::enable_shared_from_this(acceptor_.local_endpoint().port()) + L"]"; + } + void add_client_lifecycle_object_factory(const lifecycle_factory_t& factory) { auto self = shared_from_this(); -- 2.39.2