{
_stop = true;
- _search_thread->interrupt ();
+ _search_condition.notify_all ();
_search_thread->join ();
_listen_io_service.stop ();
}
}
- 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 (...)
_servers.clear ();
}
ServersListChanged ();
+ search_now ();
}
}
+
+void
+ServerFinder::search_now ()
+{
+ _search_condition.notify_all ();
+}
void handle_accept (boost::system::error_code ec, boost::shared_ptr<Socket> socket);
void config_changed (Config::Property what);
+ void search_now ();
bool _disabled;
boost::shared_ptr<boost::asio::ip::tcp::acceptor> _listen_acceptor;
bool _stop;
+ boost::condition _search_condition;
+ boost::mutex _search_condition_mutex;
+
static ServerFinder* _instance;
};