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.
This commit is contained in:
parent
73c6bc9f48
commit
05efbc402f
2 changed files with 18 additions and 11 deletions
|
@ -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);
|
||||
}
|
||||
|
|
23
src/tcp.c
23
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue