mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-01-03 14:56:34 -05:00
Feature: Use settings from the listen socket for YP if there is only one
Closes: #2354
This commit is contained in:
parent
10e9d93523
commit
b06942e1bc
@ -520,6 +520,22 @@ listensocket_t * listensocket_container_get_by_id(listensocket_container_t *self
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* may return NULL if there is no default */
|
||||
listensocket_t * listensocket_container_get_default(listensocket_container_t *self)
|
||||
{
|
||||
listensocket_t *ret = NULL;
|
||||
|
||||
thread_rwlock_rlock(&self->rwlock);
|
||||
if (self->sock_len == 1) {
|
||||
if (refobject_ref(self->sock[0]) == 0) {
|
||||
ret = self->sock[0];
|
||||
}
|
||||
}
|
||||
thread_rwlock_unlock(&self->rwlock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
listensocket_t ** listensocket_container_list_sockets(listensocket_container_t *self)
|
||||
{
|
||||
listensocket_t **res;
|
||||
|
@ -27,6 +27,7 @@ connection_t * listensocket_container_accept(listensocket_container
|
||||
int listensocket_container_set_sockcount_cb(listensocket_container_t *self, void (*cb)(size_t count, void *userdata), void *userdata);
|
||||
ssize_t listensocket_container_sockcount(listensocket_container_t *self);
|
||||
listensocket_t * listensocket_container_get_by_id(listensocket_container_t *self, const char *id);
|
||||
listensocket_t * listensocket_container_get_default(listensocket_container_t *self); /* may return NULL if there is no default */
|
||||
listensocket_t ** listensocket_container_list_sockets(listensocket_container_t *self);
|
||||
bool listensocket_container_is_family_included(listensocket_container_t *self, sock_family_t family);
|
||||
|
||||
|
5
src/yp.c
5
src/yp.c
@ -611,6 +611,11 @@ static ypdata_t *create_yp_entry (struct yp_server *server, const char *mount)
|
||||
if (!listen_socket)
|
||||
ICECAST_LOG_ERROR("Failure to find listen socket with ID %#H, using default.",
|
||||
server->listen_socket_id);
|
||||
} else {
|
||||
listen_socket = listensocket_container_get_default(global.listensockets);
|
||||
if (!listen_socket) {
|
||||
ICECAST_LOG_WARN("There is no listen socket defined for this YP nor is there a default. Listen URLs might be wrong.");
|
||||
}
|
||||
}
|
||||
ret = client_get_baseurl(NULL, listen_socket, url, len, NULL, NULL, NULL, mount, NULL);
|
||||
if (ret >= len) {
|
||||
|
Loading…
Reference in New Issue
Block a user