[vlc-devel] [PATCH 9/9] httpd: use names for the list nodes that reflects which list use the field
Steve Lhomme
robux4 at ycbcr.xyz
Fri Aug 17 15:04:41 CEST 2018
---
src/network/httpd.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/network/httpd.c b/src/network/httpd.c
index 1eff0dc0bd..2147c0eae7 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -76,7 +76,7 @@ static void httpd_AppendData(httpd_stream_t *stream, uint8_t *p_data, int i_data
struct httpd_host_t
{
struct vlc_common_members obj;
- vlc_list_node node; /* from list httpd.hosts */
+ vlc_list_node hosts_item; /* from list httpd.hosts */
/* ref count */
atomic_uint ref;
@@ -94,10 +94,10 @@ struct httpd_host_t
* This will slow down the url research but make my live easier
* All url will have their cb trigger, but only the first one can answer
* */
- struct vlc_list urls; /* intrusive in httpd_url_t.node */
+ struct vlc_list urls; /* intrusive in httpd_url_t.urls_item */
size_t client_count;
- struct vlc_list clients; /* intrusive in httpd_url_t.httpd_client_t */
+ struct vlc_list clients; /* intrusive in httpd_url_t.clients_item */
/* TLS data */
vlc_tls_creds_t *p_tls;
@@ -107,7 +107,7 @@ struct httpd_host_t
struct httpd_url_t
{
httpd_host_t *host;
- vlc_list_node node; /* from list httpd_host_t.urls */
+ vlc_list_node urls_item; /* from list httpd_host_t.urls */
vlc_mutex_t lock;
char *psz_url;
@@ -143,7 +143,7 @@ struct httpd_client_t
httpd_url_t *url;
vlc_tls_t *sock;
- vlc_list_node node; /* from list httpd_host_t.clients */
+ vlc_list_node clients_item; /* from list httpd_host_t.clients */
bool b_stream_mode;
uint8_t i_state;
@@ -901,7 +901,7 @@ httpd_host_t *vlc_rtsp_HostNew(vlc_object_t *p_this)
static struct httpd
{
vlc_mutex_t mutex;
- struct vlc_list hosts; /* intrusive in httpd_host_t.node */
+ struct vlc_list hosts; /* intrusive in httpd_host_t.hosts_item */
} httpd = { VLC_STATIC_MUTEX, VLC_LIST_INITIALIZER(&httpd.hosts) };
static httpd_host_t *httpd_HostCreate(vlc_object_t *p_this,
@@ -916,7 +916,7 @@ static httpd_host_t *httpd_HostCreate(vlc_object_t *p_this,
vlc_mutex_lock(&httpd.mutex);
/* verify if it already exist */
- vlc_list_foreach(host, &httpd.hosts, node) {
+ vlc_list_foreach(host, &httpd.hosts, hosts_item) {
/* cannot mix TLS and non-TLS hosts */
if (host->port != port
|| (host->p_tls != NULL) != (p_tls != NULL))
@@ -965,7 +965,7 @@ static httpd_host_t *httpd_HostCreate(vlc_object_t *p_this,
}
/* now add it to httpd */
- vlc_list_append(&host->node, &httpd.hosts);
+ vlc_list_append(&host->hosts_item, &httpd.hosts);
vlc_mutex_unlock(&httpd.mutex);
return host;
@@ -998,13 +998,13 @@ void httpd_HostDelete(httpd_host_t *host)
return;
}
- vlc_list_remove(&host->node);
+ vlc_list_remove(&host->hosts_item);
vlc_cancel(host->thread);
vlc_join(host->thread, NULL);
msg_Dbg(host, "HTTP host removed");
- vlc_list_foreach(client, &host->clients, node) {
+ vlc_list_foreach(client, &host->clients, clients_item) {
msg_Warn(host, "client still connected");
httpd_ClientDestroy(client);
}
@@ -1027,7 +1027,7 @@ httpd_url_t *httpd_UrlNew(httpd_host_t *host, const char *psz_url,
assert(psz_url);
vlc_mutex_lock(&host->lock);
- vlc_list_foreach(url, &host->urls, node)
+ vlc_list_foreach(url, &host->urls, urls_item)
if (!strcmp(psz_url, url->psz_url)) {
msg_Warn(host, "cannot add '%s' (url already defined)", psz_url);
vlc_mutex_unlock(&host->lock);
@@ -1051,7 +1051,7 @@ httpd_url_t *httpd_UrlNew(httpd_host_t *host, const char *psz_url,
url->catch[i].p_sys = NULL;
}
- vlc_list_append(&url->node, &host->urls);
+ vlc_list_append(&url->urls_item, &host->urls);
vlc_cond_signal(&host->wait);
vlc_mutex_unlock(&host->lock);
@@ -1077,14 +1077,14 @@ void httpd_UrlDelete(httpd_url_t *url)
httpd_client_t *client;
vlc_mutex_lock(&host->lock);
- vlc_list_remove(&url->node);
+ vlc_list_remove(&url->urls_item);
vlc_mutex_destroy(&url->lock);
free(url->psz_url);
free(url->psz_user);
free(url->psz_password);
- vlc_list_foreach(client, &host->clients, node) {
+ vlc_list_foreach(client, &host->clients, clients_item) {
if (client->url != url)
continue;
@@ -1193,7 +1193,7 @@ char* httpd_ServerIP(const httpd_client_t *cl, char *ip, int *port)
static void httpd_ClientDestroy(httpd_client_t *cl)
{
- vlc_list_remove(&cl->node);
+ vlc_list_remove(&cl->clients_item);
vlc_tls_Close(cl->sock);
httpd_MsgClean(&cl->answer);
httpd_MsgClean(&cl->query);
@@ -1690,7 +1690,7 @@ static void httpdLoop(httpd_host_t *host)
httpd_client_t *cl;
int canc = vlc_savecancel();
- vlc_list_foreach(cl, &host->clients, node) {
+ vlc_list_foreach(cl, &host->clients, clients_item) {
int64_t i_offset;
if (cl->i_state == HTTPD_CLIENT_DEAD
@@ -1804,7 +1804,7 @@ static void httpdLoop(httpd_host_t *host)
bool b_auth_failed = false;
/* Search the url and trigger callbacks */
- vlc_list_foreach(url, &host->urls, node) {
+ vlc_list_foreach(url, &host->urls, urls_item) {
if (strcmp(url->psz_url, query->psz_url))
continue;
if (!url->catch[i_msg].cb)
@@ -1948,7 +1948,7 @@ static void httpdLoop(httpd_host_t *host)
now = vlc_tick_now();
nfd = host->nfd;
- vlc_list_foreach(cl, &host->clients, node) {
+ vlc_list_foreach(cl, &host->clients, clients_item) {
const struct pollfd *pufd = &ufd[nfd];
assert(pufd < &ufd[sizeof(ufd) / sizeof(ufd[0])]);
@@ -2014,7 +2014,7 @@ static void httpdLoop(httpd_host_t *host)
cl->i_state = HTTPD_CLIENT_TLS_HS_OUT;
host->client_count++;
- vlc_list_append(&cl->node, &host->clients);
+ vlc_list_append(&cl->clients_item, &host->clients);
}
vlc_mutex_unlock(&host->lock);
--
2.17.0
More information about the vlc-devel
mailing list