summaryrefslogtreecommitdiff
path: root/src/lib/server_finder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-07-06 14:06:25 +0100
committerCarl Hetherington <cth@carlh.net>2015-07-06 14:06:25 +0100
commit96a2b6f7ce0be67248cbc612e2ef03ea7d586039 (patch)
tree09ef052f6d21eb139e2490f3680895509aaa6205 /src/lib/server_finder.cc
parenta6e7017b36ea2cee9f95c45fc0a4f85294dbc16f (diff)
Search for servers immediately when configuration changes.
Diffstat (limited to 'src/lib/server_finder.cc')
-rw-r--r--src/lib/server_finder.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/server_finder.cc b/src/lib/server_finder.cc
index ecda385eb..3eec6597b 100644
--- a/src/lib/server_finder.cc
+++ b/src/lib/server_finder.cc
@@ -54,7 +54,7 @@ ServerFinder::~ServerFinder ()
{
_stop = true;
- _search_thread->interrupt ();
+ _search_condition.notify_all ();
_search_thread->join ();
_listen_io_service.stop ();
@@ -106,11 +106,8 @@ try
}
}
- try {
- boost::thread::sleep (boost::get_system_time() + boost::posix_time::seconds (10));
- } catch (boost::thread_interrupted& e) {
- return;
- }
+ boost::mutex::scoped_lock lm (_search_condition_mutex);
+ _search_condition.timed_wait (lm, boost::get_system_time() + boost::posix_time::seconds (10));
}
}
catch (...)
@@ -224,5 +221,12 @@ ServerFinder::config_changed (Config::Property what)
_servers.clear ();
}
ServersListChanged ();
+ search_now ();
}
}
+
+void
+ServerFinder::search_now ()
+{
+ _search_condition.notify_all ();
+}