with a lock on _servers_mutex; handlers to that signal may call
::servers() which tries to take a lock on the same mutex.
}
/* Discard servers that we haven't seen for a while */
}
/* Discard servers that we haven't seen for a while */
{
boost::mutex::scoped_lock lm (_servers_mutex);
{
boost::mutex::scoped_lock lm (_servers_mutex);
list<EncodeServerDescription>::iterator i = _servers.begin();
while (i != _servers.end()) {
if (i->last_seen_seconds() > 2 * interval) {
list<EncodeServerDescription>::iterator i = _servers.begin();
while (i != _servers.end()) {
if (i->last_seen_seconds() > 2 * interval) {
- if (removed) {
- emit (boost::bind (boost::ref (ServersListChanged)));
- }
+ if (removed) {
+ emit (boost::bind (boost::ref (ServersListChanged)));
}
boost::mutex::scoped_lock lm (_search_condition_mutex);
}
boost::mutex::scoped_lock lm (_search_condition_mutex);
(*found)->set_seen ();
} else {
EncodeServerDescription sd (ip, xml->number_child<int>("Threads"), xml->optional_number_child<int>("Version").get_value_or(0));
(*found)->set_seen ();
} else {
EncodeServerDescription sd (ip, xml->number_child<int>("Threads"), xml->optional_number_child<int>("Version").get_value_or(0));
- boost::mutex::scoped_lock lm (_servers_mutex);
- _servers.push_back (sd);
+ {
+ boost::mutex::scoped_lock lm (_servers_mutex);
+ _servers.push_back (sd);
+ }
emit (boost::bind (boost::ref (ServersListChanged)));
}
emit (boost::bind (boost::ref (ServersListChanged)));
}