X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=src%2Fweb_client.c;h=b5b25899f624f30b97c3667ec4b53444e93c7cd8;hb=b060bae83cc36fdc4f14120228e4c9b0d1ec42e8;hp=908e72a39a536997b6be22c432785d722d932e4c;hpb=cacc1a70bcb6926a7b56f9f3a2e8948aea29e145;p=netdata.git diff --git a/src/web_client.c b/src/web_client.c index 908e72a3..b5b25899 100644 --- a/src/web_client.c +++ b/src/web_client.c @@ -25,6 +25,8 @@ static inline int web_client_crock_socket(struct web_client *w) { return -1; } } +#else + (void)w; #endif /* TCP_CORK */ return 0; @@ -40,6 +42,8 @@ static inline int web_client_uncrock_socket(struct web_client *w) { return -1; } } +#else + (void)w; #endif /* TCP_CORK */ return 0; @@ -1034,19 +1038,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); + host = rrdhost_find_by_hostname(tok, hash); + if(!host) host = rrdhost_find_by_guid(tok, hash); - 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(); + if(host) return web_client_process_url(host, w, url); } buffer_flush(w->response.data);