- string const ip = socket->socket().remote_endpoint().address().to_string ();
- optional<list<EncodeServerDescription>::iterator> found = server_found (ip);
- if (found) {
- (*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);
+ auto const ip = _accept_socket->socket().remote_endpoint().address().to_string();
+ bool changed = false;
+ {
+ boost::mutex::scoped_lock lm (_servers_mutex);
+ auto i = _servers.begin();
+ while (i != _servers.end() && i->host_name() != ip) {
+ ++i;