Commit ab8d1639 authored by Philipp Schafft's avatar Philipp Schafft 🦁

Update: Made listensocket_* perfect thread safe.

parent fcef3f12
...@@ -623,6 +623,8 @@ static client_queue_t *create_client_node(client_t *client) ...@@ -623,6 +623,8 @@ static client_queue_t *create_client_node(client_t *client)
node->shoutcast_mount = strdup(listener->shoutcast_mount); node->shoutcast_mount = strdup(listener->shoutcast_mount);
} }
listensocket_release_listener(client->con->listensocket_effective);
return node; return node;
} }
...@@ -1216,6 +1218,7 @@ static int _handle_resources(client_t *client, char **uri) ...@@ -1216,6 +1218,7 @@ static int _handle_resources(client_t *client, char **uri)
break; break;
} }
listensocket_release_listener(client->con->listensocket_effective);
config_release_config(); config_release_config();
if (new_uri) { if (new_uri) {
...@@ -1405,15 +1408,17 @@ static void __prepare_shoutcast_admin_cgi_request(client_t *client) ...@@ -1405,15 +1408,17 @@ static void __prepare_shoutcast_admin_cgi_request(client_t *client)
return; return;
} }
listener = listensocket_get_listener(client->con->listensocket_effective);
global_lock(); global_lock();
config = config_get_config(); config = config_get_config();
sc_mount = config->shoutcast_mount; sc_mount = config->shoutcast_mount;
listener = listensocket_get_listener(client->con->listensocket_effective);
if (listener && listener->shoutcast_mount) if (listener && listener->shoutcast_mount)
sc_mount = listener->shoutcast_mount; sc_mount = listener->shoutcast_mount;
httpp_set_query_param(client->parser, "mount", sc_mount); httpp_set_query_param(client->parser, "mount", sc_mount);
listensocket_release_listener(client->con->listensocket_effective);
httpp_setvar(client->parser, HTTPP_VAR_PROTOCOL, "ICY"); httpp_setvar(client->parser, HTTPP_VAR_PROTOCOL, "ICY");
client->password = strdup(pass); client->password = strdup(pass);
config_release_config(); config_release_config();
......
This diff is collapsed.
...@@ -24,5 +24,6 @@ int listensocket_refsock(listensocket_t *self); ...@@ -24,5 +24,6 @@ int listensocket_refsock(listensocket_t *self);
int listensocket_unrefsock(listensocket_t *self); int listensocket_unrefsock(listensocket_t *self);
connection_t * listensocket_accept(listensocket_t *self); connection_t * listensocket_accept(listensocket_t *self);
const listener_t * listensocket_get_listener(listensocket_t *self); const listener_t * listensocket_get_listener(listensocket_t *self);
int listensocket_release_listener(listensocket_t *self);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment