From 05efbc402f1c891b3c4a3fa51419150531880ead Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Mon, 11 Nov 2013 17:41:05 +0000 Subject: [PATCH] status: remove HTTP status info for now This breaks if, like me, you're using a proxy (or browser) which doesn't support persitent connections, since you just get a constant reloading of the UI! Will have to re-think, since ultimately what I really want is to know user auth's within the UI, so possibly that will be easier when we do away with HTTP Basic Auth, but also probably require restructuring of this code. --- src/http.c | 6 ++++-- src/tcp.c | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/http.c b/src/http.c index 0adc721f..a78e290a 100644 --- a/src/http.c +++ b/src/http.c @@ -815,14 +815,16 @@ http_serve(int fd, void **opaque, struct sockaddr_storage *peer, pthread_mutex_unlock(&global_lock); } +#if 0 static void http_server_status ( void *opaque, htsmsg_t *m ) { - http_connection_t *hc = opaque; +// http_connection_t *hc = opaque; htsmsg_add_str(m, "type", "HTTP"); if (hc->hc_username) htsmsg_add_str(m, "user", hc->hc_username); } +#endif /** * Fire up HTTP server @@ -833,7 +835,7 @@ http_server_init(const char *bindaddr) static tcp_server_ops_t ops = { .start = http_serve, .stop = NULL, - .status = http_server_status, + .status = NULL, }; http_server = tcp_server_create(bindaddr, tvheadend_webui_port, &ops, NULL); } diff --git a/src/tcp.c b/src/tcp.c index 0157ead9..b84aaa7a 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -434,18 +434,22 @@ tcp_server_start(void *aux) /* Start */ time(&tsl->started); - pthread_mutex_lock(&global_lock); - LIST_INSERT_HEAD(&tcp_server_launches, tsl, link); - notify_reload("connections"); - pthread_mutex_unlock(&global_lock); + if (tsl->ops.status) { + pthread_mutex_lock(&global_lock); + LIST_INSERT_HEAD(&tcp_server_launches, tsl, link); + notify_reload("connections"); + pthread_mutex_unlock(&global_lock); + } tsl->ops.start(tsl->fd, &tsl->opaque, &tsl->peer, &tsl->self); /* Stop */ if (tsl->ops.stop) tsl->ops.stop(tsl->opaque); - pthread_mutex_lock(&global_lock); - LIST_REMOVE(tsl, link); - notify_reload("connections"); - pthread_mutex_unlock(&global_lock); + if (tsl->ops.status) { + pthread_mutex_lock(&global_lock); + LIST_REMOVE(tsl, link); + notify_reload("connections"); + pthread_mutex_unlock(&global_lock); + } free(tsl); return NULL; @@ -612,12 +616,13 @@ tcp_server_connections ( void ) /* Build list */ l = htsmsg_create_list(); LIST_FOREACH(tsl, &tcp_server_launches, link) { + if (!tsl->ops.status) continue; c++; e = htsmsg_create_map(); tcp_get_ip_str((struct sockaddr*)&tsl->peer, buf, sizeof(buf)); htsmsg_add_str(e, "peer", buf); htsmsg_add_s64(e, "started", tsl->started); - if (tsl->ops.status) tsl->ops.status(tsl->opaque, e); + tsl->ops.status(tsl->opaque, e); htsmsg_add_msg(l, NULL, e); }