From 7ae514af0aea1b953a93f88d5507e6c1dd675908 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 6 Jul 2015 13:37:35 +0100 Subject: Better updating of servers list when things change. --- src/lib/encoder.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/lib/encoder.cc') diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index c3ad08441..07c97c674 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -36,6 +36,7 @@ #include "data.h" #include #include +#include #include #include "i18n.h" @@ -66,7 +67,7 @@ Encoder::Encoder (shared_ptr film, weak_ptr j, shared_ptrset_encoder_threads (_threads.size ()); if (!ServerFinder::instance()->disabled ()) { - _server_found_connection = ServerFinder::instance()->connect (boost::bind (&Encoder::server_found, this, _1)); + _server_found_connection = ServerFinder::instance()->ServersListChanged.connect (boost::bind (&Encoder::servers_list_changed, this)); } } @@ -271,6 +272,7 @@ Encoder::terminate_threads () } _threads.clear (); + _terminate = false; } void @@ -362,7 +364,10 @@ catch (...) } void -Encoder::server_found (ServerDescription s) +Encoder::servers_list_changed () { - add_worker_threads (s); + terminate_threads (); + BOOST_FOREACH (ServerDescription i, ServerFinder::instance()->servers ()) { + add_worker_threads (i); + } } -- cgit v1.2.3