diff --git a/daemon/rtsp_client.cpp b/daemon/rtsp_client.cpp index 14d3938..eb92b4a 100644 --- a/daemon/rtsp_client.cpp +++ b/daemon/rtsp_client.cpp @@ -109,9 +109,8 @@ std::pair RtspClient::process( const std::string& port, bool wait_for_updates) { RtspSource rtsp_source; + ip::tcp::iostream s; try { - ip::tcp::iostream s; - BOOST_LOG_TRIVIAL(debug) << "rtsp_client:: connecting to " << "rtsp://" << address << ":" << port << path; s.connect(address, port.length() ? port : dft_port); @@ -249,9 +248,11 @@ std::pair RtspClient::process( } if (wait_for_updates) { - auto name_domain = std::make_pair(name, domain); std::lock_guard lock(g_mutex); - g_active_clients.erase(name_domain); + auto it = g_active_clients.find(std::make_pair(name, domain)); + if (it != g_active_clients.end() && it->second == &s) { + g_active_clients.erase(it); + } } return std::make_pair(true, rtsp_source);