X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=src%2Fweb_client.c;h=ef39d3b5834e92ff2444848816fca0e6db94f11b;hb=2dc4b3d89cf602e616d6a3d51fce5dfbab5930da;hp=908e72a39a536997b6be22c432785d722d932e4c;hpb=719ba47914bad933bf4503d3340b9543d5e631a6;p=netdata.git diff --git a/src/web_client.c b/src/web_client.c index 908e72a3..ef39d3b5 100644 --- a/src/web_client.c +++ b/src/web_client.c @@ -1034,19 +1034,10 @@ static inline int web_client_switch_host(RRDHOST *host, struct web_client *w, ch uint32_t hash = simple_hash(tok); - if(unlikely(hash == hash_localhost && !strcmp(tok, "localhost"))) - return web_client_process_url(localhost, w, url); - - rrd_rdlock(); - RRDHOST *h; - rrdhost_foreach_read(h) { - if(unlikely((hash == h->hash_hostname && !strcmp(tok, h->hostname)) || - (hash == h->hash_machine_guid && !strcmp(tok, h->machine_guid)))) { - rrd_unlock(); - return web_client_process_url(h, w, url); - } - } - rrd_unlock(); + host = rrdhost_find_by_hostname(tok, hash); + if(!host) host = rrdhost_find_by_guid(tok, hash); + + if(host) return web_client_process_url(host, w, url); } buffer_flush(w->response.data);