mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
LOG_{ERROR|WARN|INFO|DEBUG}() -> ICECAST_LOG_{ERROR|WARN|INFO|DEBUG}(); this is to avoid collision with LOG_INFO that is defined as part of syslog.
svn path=/icecast/trunk/icecast/; revision=19257
This commit is contained in:
parent
cf419cc1df
commit
2b7cb1c641
60
src/admin.c
60
src/admin.c
@ -300,7 +300,7 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
|
|||||||
config->adminroot_dir, PATH_SEPARATOR, xslt_template);
|
config->adminroot_dir, PATH_SEPARATOR, xslt_template);
|
||||||
config_release_config();
|
config_release_config();
|
||||||
|
|
||||||
LOG_DEBUG("Sending XSLT (%s)", fullpath_xslt_template);
|
ICECAST_LOG_DEBUG("Sending XSLT (%s)", fullpath_xslt_template);
|
||||||
xslt_transform(doc, fullpath_xslt_template, client);
|
xslt_transform(doc, fullpath_xslt_template, client);
|
||||||
free(fullpath_xslt_template);
|
free(fullpath_xslt_template);
|
||||||
}
|
}
|
||||||
@ -312,10 +312,10 @@ void admin_handle_request(client_t *client, const char *uri)
|
|||||||
const char *mount, *command_string;
|
const char *mount, *command_string;
|
||||||
int command;
|
int command;
|
||||||
|
|
||||||
LOG_DEBUG("Admin request (%s)", uri);
|
ICECAST_LOG_DEBUG("Admin request (%s)", uri);
|
||||||
if (!((strcmp(uri, "/admin.cgi") == 0) ||
|
if (!((strcmp(uri, "/admin.cgi") == 0) ||
|
||||||
(strncmp("/admin/", uri, 7) == 0))) {
|
(strncmp("/admin/", uri, 7) == 0))) {
|
||||||
LOG_ERROR("Internal error: admin request isn't");
|
ICECAST_LOG_ERROR("Internal error: admin request isn't");
|
||||||
client_send_401(client);
|
client_send_401(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -327,11 +327,11 @@ void admin_handle_request(client_t *client, const char *uri)
|
|||||||
command_string = uri + 7;
|
command_string = uri + 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG("Got command (%s)", command_string);
|
ICECAST_LOG_DEBUG("Got command (%s)", command_string);
|
||||||
command = admin_get_command(command_string);
|
command = admin_get_command(command_string);
|
||||||
|
|
||||||
if(command < 0) {
|
if(command < 0) {
|
||||||
LOG_ERROR("Error parsing command string or unrecognised command: %s",
|
ICECAST_LOG_ERROR("Error parsing command string or unrecognised command: %s",
|
||||||
command_string);
|
command_string);
|
||||||
client_send_400(client, "Unrecognised command");
|
client_send_400(client, "Unrecognised command");
|
||||||
return;
|
return;
|
||||||
@ -383,7 +383,7 @@ void admin_handle_request(client_t *client, const char *uri)
|
|||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_INFO("Bad or missing password on mount modification admin "
|
ICECAST_LOG_INFO("Bad or missing password on mount modification admin "
|
||||||
"request (command: %s)", command_string);
|
"request (command: %s)", command_string);
|
||||||
client_send_401(client);
|
client_send_401(client);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
@ -397,7 +397,7 @@ void admin_handle_request(client_t *client, const char *uri)
|
|||||||
|
|
||||||
if (source == NULL)
|
if (source == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("Admin command %s on non-existent source %s",
|
ICECAST_LOG_WARN("Admin command %s on non-existent source %s",
|
||||||
command_string, mount);
|
command_string, mount);
|
||||||
avl_tree_unlock(global.source_tree);
|
avl_tree_unlock(global.source_tree);
|
||||||
client_send_400(client, "Source does not exist");
|
client_send_400(client, "Source does not exist");
|
||||||
@ -407,7 +407,7 @@ void admin_handle_request(client_t *client, const char *uri)
|
|||||||
if (source->running == 0 && source->on_demand == 0)
|
if (source->running == 0 && source->on_demand == 0)
|
||||||
{
|
{
|
||||||
avl_tree_unlock (global.source_tree);
|
avl_tree_unlock (global.source_tree);
|
||||||
LOG_INFO("Received admin command %s on unavailable mount \"%s\"",
|
ICECAST_LOG_INFO("Received admin command %s on unavailable mount \"%s\"",
|
||||||
command_string, mount);
|
command_string, mount);
|
||||||
client_send_400 (client, "Source is not available");
|
client_send_400 (client, "Source is not available");
|
||||||
return;
|
return;
|
||||||
@ -416,12 +416,12 @@ void admin_handle_request(client_t *client, const char *uri)
|
|||||||
source->shoutcast_compat == 0)
|
source->shoutcast_compat == 0)
|
||||||
{
|
{
|
||||||
avl_tree_unlock (global.source_tree);
|
avl_tree_unlock (global.source_tree);
|
||||||
LOG_ERROR("illegal change of metadata on non-shoutcast "
|
ICECAST_LOG_ERROR("illegal change of metadata on non-shoutcast "
|
||||||
"compatible stream");
|
"compatible stream");
|
||||||
client_send_400 (client, "illegal metadata call");
|
client_send_400 (client, "illegal metadata call");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_INFO("Received admin command %s on mount \"%s\"",
|
ICECAST_LOG_INFO("Received admin command %s on mount \"%s\"",
|
||||||
command_string, mount);
|
command_string, mount);
|
||||||
admin_handle_mount_request(client, source, command);
|
admin_handle_mount_request(client, source, command);
|
||||||
avl_tree_unlock(global.source_tree);
|
avl_tree_unlock(global.source_tree);
|
||||||
@ -434,7 +434,7 @@ void admin_handle_request(client_t *client, const char *uri)
|
|||||||
mounts from the master, so handle this request
|
mounts from the master, so handle this request
|
||||||
validating against the relay password */
|
validating against the relay password */
|
||||||
if(!connection_check_relay_pass(client->parser)) {
|
if(!connection_check_relay_pass(client->parser)) {
|
||||||
LOG_INFO("Bad or missing password on admin command "
|
ICECAST_LOG_INFO("Bad or missing password on admin command "
|
||||||
"request (command: %s)", command_string);
|
"request (command: %s)", command_string);
|
||||||
client_send_401(client);
|
client_send_401(client);
|
||||||
return;
|
return;
|
||||||
@ -442,7 +442,7 @@ void admin_handle_request(client_t *client, const char *uri)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(!connection_check_admin_pass(client->parser)) {
|
if(!connection_check_admin_pass(client->parser)) {
|
||||||
LOG_INFO("Bad or missing password on admin command "
|
ICECAST_LOG_INFO("Bad or missing password on admin command "
|
||||||
"request (command: %s)", command_string);
|
"request (command: %s)", command_string);
|
||||||
client_send_401(client);
|
client_send_401(client);
|
||||||
return;
|
return;
|
||||||
@ -481,7 +481,7 @@ static void admin_handle_general_request(client_t *client, int command)
|
|||||||
command_list_mounts(client, TRANSFORMED);
|
command_list_mounts(client, TRANSFORMED);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_WARN("General admin request not recognised");
|
ICECAST_LOG_WARN("General admin request not recognised");
|
||||||
client_send_400(client, "Unknown admin request");
|
client_send_400(client, "Unknown admin request");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -549,7 +549,7 @@ static void admin_handle_mount_request(client_t *client, source_t *source,
|
|||||||
command_updatemetadata(client, source, RAW);
|
command_updatemetadata(client, source, RAW);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_WARN("Mount request not recognised");
|
ICECAST_LOG_WARN("Mount request not recognised");
|
||||||
client_send_400(client, "Mount request unknown");
|
client_send_400(client, "Mount request unknown");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -594,11 +594,11 @@ static void command_move_clients(client_t *client, source_t *source,
|
|||||||
char buf[255];
|
char buf[255];
|
||||||
int parameters_passed = 0;
|
int parameters_passed = 0;
|
||||||
|
|
||||||
LOG_DEBUG("Doing optional check");
|
ICECAST_LOG_DEBUG("Doing optional check");
|
||||||
if((COMMAND_OPTIONAL(client, "destination", dest_source))) {
|
if((COMMAND_OPTIONAL(client, "destination", dest_source))) {
|
||||||
parameters_passed = 1;
|
parameters_passed = 1;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("Done optional check (%d)", parameters_passed);
|
ICECAST_LOG_DEBUG("Done optional check (%d)", parameters_passed);
|
||||||
if (!parameters_passed) {
|
if (!parameters_passed) {
|
||||||
doc = admin_build_sourcelist(source->mount);
|
doc = admin_build_sourcelist(source->mount);
|
||||||
admin_send_response(doc, client, response,
|
admin_send_response(doc, client, response,
|
||||||
@ -627,7 +627,7 @@ static void command_move_clients(client_t *client, source_t *source,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("source is \"%s\", destination is \"%s\"", source->mount, dest->mount);
|
ICECAST_LOG_INFO("source is \"%s\", destination is \"%s\"", source->mount, dest->mount);
|
||||||
|
|
||||||
doc = xmlNewDoc (XMLSTR("1.0"));
|
doc = xmlNewDoc (XMLSTR("1.0"));
|
||||||
node = xmlNewDocNode(doc, NULL, XMLSTR("iceresponse"), NULL);
|
node = xmlNewDocNode(doc, NULL, XMLSTR("iceresponse"), NULL);
|
||||||
@ -748,7 +748,7 @@ static void command_manageauth(client_t *client, source_t *source,
|
|||||||
{
|
{
|
||||||
if (mountinfo == NULL || mountinfo->auth == NULL)
|
if (mountinfo == NULL || mountinfo->auth == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("manage auth request for %s but no facility available", source->mount);
|
ICECAST_LOG_WARN("manage auth request for %s but no facility available", source->mount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
COMMAND_OPTIONAL(client, "action", action);
|
COMMAND_OPTIONAL(client, "action", action);
|
||||||
@ -764,7 +764,7 @@ static void command_manageauth(client_t *client, source_t *source,
|
|||||||
|
|
||||||
if (username == NULL || password == NULL)
|
if (username == NULL || password == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("manage auth request add for %s but no user/pass", source->mount);
|
ICECAST_LOG_WARN("manage auth request add for %s but no user/pass", source->mount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = mountinfo->auth->adduser(mountinfo->auth, username, password);
|
ret = mountinfo->auth->adduser(mountinfo->auth, username, password);
|
||||||
@ -782,7 +782,7 @@ static void command_manageauth(client_t *client, source_t *source,
|
|||||||
{
|
{
|
||||||
if (username == NULL)
|
if (username == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("manage auth request delete for %s but no username", source->mount);
|
ICECAST_LOG_WARN("manage auth request delete for %s but no username", source->mount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = mountinfo->auth->deleteuser(mountinfo->auth, username);
|
ret = mountinfo->auth->deleteuser(mountinfo->auth, username);
|
||||||
@ -860,10 +860,10 @@ static void command_kill_client(client_t *client, source_t *source,
|
|||||||
doc = xmlNewDoc (XMLSTR("1.0"));
|
doc = xmlNewDoc (XMLSTR("1.0"));
|
||||||
node = xmlNewDocNode(doc, NULL, XMLSTR("iceresponse"), NULL);
|
node = xmlNewDocNode(doc, NULL, XMLSTR("iceresponse"), NULL);
|
||||||
xmlDocSetRootElement(doc, node);
|
xmlDocSetRootElement(doc, node);
|
||||||
LOG_DEBUG("Response is %d", response);
|
ICECAST_LOG_DEBUG("Response is %d", response);
|
||||||
|
|
||||||
if(listener != NULL) {
|
if(listener != NULL) {
|
||||||
LOG_INFO("Admin request: client %d removed", id);
|
ICECAST_LOG_INFO("Admin request: client %d removed", id);
|
||||||
|
|
||||||
/* This tags it for removal on the next iteration of the main source
|
/* This tags it for removal on the next iteration of the main source
|
||||||
* loop
|
* loop
|
||||||
@ -891,7 +891,7 @@ static void command_fallback(client_t *client, source_t *source,
|
|||||||
const char *fallback;
|
const char *fallback;
|
||||||
char *old;
|
char *old;
|
||||||
|
|
||||||
LOG_DEBUG("Got fallback request");
|
ICECAST_LOG_DEBUG("Got fallback request");
|
||||||
|
|
||||||
COMMAND_REQUIRE(client, "fallback", fallback);
|
COMMAND_REQUIRE(client, "fallback", fallback);
|
||||||
|
|
||||||
@ -916,7 +916,7 @@ static void command_metadata(client_t *client, source_t *source,
|
|||||||
node = xmlNewDocNode (doc, NULL, XMLSTR("iceresponse"), NULL);
|
node = xmlNewDocNode (doc, NULL, XMLSTR("iceresponse"), NULL);
|
||||||
xmlDocSetRootElement(doc, node);
|
xmlDocSetRootElement(doc, node);
|
||||||
|
|
||||||
LOG_DEBUG("Got metadata update request");
|
ICECAST_LOG_DEBUG("Got metadata update request");
|
||||||
|
|
||||||
COMMAND_REQUIRE(client, "mode", action);
|
COMMAND_REQUIRE(client, "mode", action);
|
||||||
COMMAND_OPTIONAL(client, "song", song);
|
COMMAND_OPTIONAL(client, "song", song);
|
||||||
@ -944,7 +944,7 @@ static void command_metadata(client_t *client, source_t *source,
|
|||||||
if (song)
|
if (song)
|
||||||
{
|
{
|
||||||
plugin->set_tag (plugin, "song", song, charset);
|
plugin->set_tag (plugin, "song", song, charset);
|
||||||
LOG_INFO("Metadata on mountpoint %s changed to \"%s\"", source->mount, song);
|
ICECAST_LOG_INFO("Metadata on mountpoint %s changed to \"%s\"", source->mount, song);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -952,7 +952,7 @@ static void command_metadata(client_t *client, source_t *source,
|
|||||||
{
|
{
|
||||||
plugin->set_tag (plugin, "title", title, charset);
|
plugin->set_tag (plugin, "title", title, charset);
|
||||||
plugin->set_tag (plugin, "artist", artist, charset);
|
plugin->set_tag (plugin, "artist", artist, charset);
|
||||||
LOG_INFO("Metadata on mountpoint %s changed to \"%s - %s\"",
|
ICECAST_LOG_INFO("Metadata on mountpoint %s changed to \"%s - %s\"",
|
||||||
source->mount, artist, title);
|
source->mount, artist, title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -983,7 +983,7 @@ static void command_shoutcast_metadata(client_t *client, source_t *source)
|
|||||||
const char *value;
|
const char *value;
|
||||||
int same_ip = 1;
|
int same_ip = 1;
|
||||||
|
|
||||||
LOG_DEBUG("Got shoutcast metadata update request");
|
ICECAST_LOG_DEBUG("Got shoutcast metadata update request");
|
||||||
|
|
||||||
COMMAND_REQUIRE(client, "mode", action);
|
COMMAND_REQUIRE(client, "mode", action);
|
||||||
COMMAND_REQUIRE(client, "song", value);
|
COMMAND_REQUIRE(client, "song", value);
|
||||||
@ -1002,7 +1002,7 @@ static void command_shoutcast_metadata(client_t *client, source_t *source)
|
|||||||
source->format->set_tag (source->format, "title", value, NULL);
|
source->format->set_tag (source->format, "title", value, NULL);
|
||||||
source->format->set_tag (source->format, NULL, NULL, NULL);
|
source->format->set_tag (source->format, NULL, NULL, NULL);
|
||||||
|
|
||||||
LOG_DEBUG("Metadata on mountpoint %s changed to \"%s\"",
|
ICECAST_LOG_DEBUG("Metadata on mountpoint %s changed to \"%s\"",
|
||||||
source->mount, value);
|
source->mount, value);
|
||||||
html_success(client, "Metadata update successful");
|
html_success(client, "Metadata update successful");
|
||||||
}
|
}
|
||||||
@ -1015,7 +1015,7 @@ static void command_shoutcast_metadata(client_t *client, source_t *source)
|
|||||||
static void command_stats(client_t *client, const char *mount, int response) {
|
static void command_stats(client_t *client, const char *mount, int response) {
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
|
||||||
LOG_DEBUG("Stats request, sending xml stats");
|
ICECAST_LOG_DEBUG("Stats request, sending xml stats");
|
||||||
|
|
||||||
doc = stats_get_xml(1, mount);
|
doc = stats_get_xml(1, mount);
|
||||||
admin_send_response(doc, client, response, STATS_TRANSFORMED_REQUEST);
|
admin_send_response(doc, client, response, STATS_TRANSFORMED_REQUEST);
|
||||||
@ -1025,7 +1025,7 @@ static void command_stats(client_t *client, const char *mount, int response) {
|
|||||||
|
|
||||||
static void command_list_mounts(client_t *client, int response)
|
static void command_list_mounts(client_t *client, int response)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("List mounts request");
|
ICECAST_LOG_DEBUG("List mounts request");
|
||||||
|
|
||||||
if (response == PLAINTEXT)
|
if (response == PLAINTEXT)
|
||||||
{
|
{
|
||||||
|
62
src/auth.c
62
src/auth.c
@ -59,7 +59,7 @@ static auth_client *auth_client_setup (const char *mount, client_t *client)
|
|||||||
userpass = util_base64_decode (header+6);
|
userpass = util_base64_decode (header+6);
|
||||||
if (userpass == NULL)
|
if (userpass == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("Base64 decode of Authorization header \"%s\" failed",
|
ICECAST_LOG_WARN("Base64 decode of Authorization header \"%s\" failed",
|
||||||
header+6);
|
header+6);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ static auth_client *auth_client_setup (const char *mount, client_t *client)
|
|||||||
free (userpass);
|
free (userpass);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LOG_INFO("unhandled authorization header: %s", header);
|
ICECAST_LOG_INFO("unhandled authorization header: %s", header);
|
||||||
|
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
@ -109,17 +109,17 @@ static void queue_auth_client (auth_client *auth_user, mount_proxy *mountinfo)
|
|||||||
{
|
{
|
||||||
if (auth_user->client == NULL || auth_user->client->auth == NULL)
|
if (auth_user->client == NULL || auth_user->client->auth == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("internal state is incorrect for %p", auth_user->client);
|
ICECAST_LOG_WARN("internal state is incorrect for %p", auth_user->client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auth = auth_user->client->auth;
|
auth = auth_user->client->auth;
|
||||||
thread_mutex_lock (&auth->lock);
|
thread_mutex_lock (&auth->lock);
|
||||||
}
|
}
|
||||||
LOG_DEBUG("...refcount on auth_t %s is now %d", auth->mount, auth->refcount);
|
ICECAST_LOG_DEBUG("...refcount on auth_t %s is now %d", auth->mount, auth->refcount);
|
||||||
*auth->tailp = auth_user;
|
*auth->tailp = auth_user;
|
||||||
auth->tailp = &auth_user->next;
|
auth->tailp = &auth_user->next;
|
||||||
auth->pending_count++;
|
auth->pending_count++;
|
||||||
LOG_INFO("auth on %s has %d pending", auth->mount, auth->pending_count);
|
ICECAST_LOG_INFO("auth on %s has %d pending", auth->mount, auth->pending_count);
|
||||||
thread_mutex_unlock (&auth->lock);
|
thread_mutex_unlock (&auth->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ void auth_release (auth_t *authenticator)
|
|||||||
|
|
||||||
thread_mutex_lock (&authenticator->lock);
|
thread_mutex_lock (&authenticator->lock);
|
||||||
authenticator->refcount--;
|
authenticator->refcount--;
|
||||||
LOG_DEBUG("...refcount on auth_t %s is now %d", authenticator->mount, authenticator->refcount);
|
ICECAST_LOG_DEBUG("...refcount on auth_t %s is now %d", authenticator->mount, authenticator->refcount);
|
||||||
if (authenticator->refcount)
|
if (authenticator->refcount)
|
||||||
{
|
{
|
||||||
thread_mutex_unlock (&authenticator->lock);
|
thread_mutex_unlock (&authenticator->lock);
|
||||||
@ -199,7 +199,7 @@ static void auth_new_listener (auth_t *auth, auth_client *auth_user)
|
|||||||
* can be avoided if client has disconnected */
|
* can be avoided if client has disconnected */
|
||||||
if (is_listener_connected (client) == 0)
|
if (is_listener_connected (client) == 0)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("listener is no longer connected");
|
ICECAST_LOG_DEBUG("listener is no longer connected");
|
||||||
client->respcode = 400;
|
client->respcode = 400;
|
||||||
auth_release (client->auth);
|
auth_release (client->auth);
|
||||||
client->auth = NULL;
|
client->auth = NULL;
|
||||||
@ -218,7 +218,7 @@ static void auth_new_listener (auth_t *auth, auth_client *auth_user)
|
|||||||
{
|
{
|
||||||
auth_release (client->auth);
|
auth_release (client->auth);
|
||||||
client->auth = NULL;
|
client->auth = NULL;
|
||||||
LOG_INFO("client %lu failed", client->con->id);
|
ICECAST_LOG_INFO("client %lu failed", client->con->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ static void stream_auth_callback (auth_t *auth, auth_client *auth_user)
|
|||||||
if (client->authenticated)
|
if (client->authenticated)
|
||||||
auth_postprocess_source (auth_user);
|
auth_postprocess_source (auth_user);
|
||||||
else
|
else
|
||||||
LOG_WARN("Failed auth for source \"%s\"", auth_user->mount);
|
ICECAST_LOG_WARN("Failed auth for source \"%s\"", auth_user->mount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ static void *auth_run_thread (void *arg)
|
|||||||
{
|
{
|
||||||
auth_t *auth = arg;
|
auth_t *auth = arg;
|
||||||
|
|
||||||
LOG_INFO("Authentication thread started");
|
ICECAST_LOG_INFO("Authentication thread started");
|
||||||
while (auth->running)
|
while (auth->running)
|
||||||
{
|
{
|
||||||
/* usually no clients are waiting, so don't bother taking locks */
|
/* usually no clients are waiting, so don't bother taking locks */
|
||||||
@ -300,7 +300,7 @@ static void *auth_run_thread (void *arg)
|
|||||||
thread_mutex_unlock (&auth->lock);
|
thread_mutex_unlock (&auth->lock);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("%d client(s) pending on %s", auth->pending_count, auth->mount);
|
ICECAST_LOG_DEBUG("%d client(s) pending on %s", auth->pending_count, auth->mount);
|
||||||
auth->head = auth_user->next;
|
auth->head = auth_user->next;
|
||||||
if (auth->head == NULL)
|
if (auth->head == NULL)
|
||||||
auth->tailp = &auth->head;
|
auth->tailp = &auth->head;
|
||||||
@ -311,7 +311,7 @@ static void *auth_run_thread (void *arg)
|
|||||||
if (auth_user->process)
|
if (auth_user->process)
|
||||||
auth_user->process (auth, auth_user);
|
auth_user->process (auth, auth_user);
|
||||||
else
|
else
|
||||||
LOG_ERROR("client auth process not set");
|
ICECAST_LOG_ERROR("client auth process not set");
|
||||||
|
|
||||||
auth_client_free (auth_user);
|
auth_client_free (auth_user);
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ static void *auth_run_thread (void *arg)
|
|||||||
}
|
}
|
||||||
thread_sleep (150000);
|
thread_sleep (150000);
|
||||||
}
|
}
|
||||||
LOG_INFO("Authenication thread shutting down");
|
ICECAST_LOG_INFO("Authenication thread shutting down");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ static int add_listener_to_source (source_t *source, client_t *client)
|
|||||||
int loop = 10;
|
int loop = 10;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
LOG_DEBUG("max on %s is %ld (cur %lu)", source->mount,
|
ICECAST_LOG_DEBUG("max on %s is %ld (cur %lu)", source->mount,
|
||||||
source->max_listeners, source->listeners);
|
source->max_listeners, source->listeners);
|
||||||
if (source->max_listeners == -1)
|
if (source->max_listeners == -1)
|
||||||
break;
|
break;
|
||||||
@ -391,12 +391,12 @@ static int add_listener_to_source (source_t *source, client_t *client)
|
|||||||
{
|
{
|
||||||
source_t *next = source_find_mount (source->fallback_mount);
|
source_t *next = source_find_mount (source->fallback_mount);
|
||||||
if (!next) {
|
if (!next) {
|
||||||
LOG_ERROR("Fallback '%s' for full source '%s' not found",
|
ICECAST_LOG_ERROR("Fallback '%s' for full source '%s' not found",
|
||||||
source->mount, source->fallback_mount);
|
source->mount, source->fallback_mount);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("stream full trying %s", next->mount);
|
ICECAST_LOG_INFO("stream full trying %s", next->mount);
|
||||||
source = next;
|
source = next;
|
||||||
loop--;
|
loop--;
|
||||||
continue;
|
continue;
|
||||||
@ -419,10 +419,10 @@ static int add_listener_to_source (source_t *source, client_t *client)
|
|||||||
if (source->running == 0 && source->on_demand)
|
if (source->running == 0 && source->on_demand)
|
||||||
{
|
{
|
||||||
/* enable on-demand relay to start, wake up the slave thread */
|
/* enable on-demand relay to start, wake up the slave thread */
|
||||||
LOG_DEBUG("kicking off on-demand relay");
|
ICECAST_LOG_DEBUG("kicking off on-demand relay");
|
||||||
source->on_demand_req = 1;
|
source->on_demand_req = 1;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("Added client to %s", source->mount);
|
ICECAST_LOG_DEBUG("Added client to %s", source->mount);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ static int add_authenticated_listener (const char *mount, mount_proxy *mountinfo
|
|||||||
if (util_check_valid_extension (mount) == XSLT_CONTENT)
|
if (util_check_valid_extension (mount) == XSLT_CONTENT)
|
||||||
{
|
{
|
||||||
/* If the file exists, then transform it, otherwise, write a 404 */
|
/* If the file exists, then transform it, otherwise, write a 404 */
|
||||||
LOG_DEBUG("Stats request, sending XSL transformed stats");
|
ICECAST_LOG_DEBUG("Stats request, sending XSL transformed stats");
|
||||||
stats_transform_xslt (client, mount);
|
stats_transform_xslt (client, mount);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -469,7 +469,7 @@ static int add_authenticated_listener (const char *mount, mount_proxy *mountinfo
|
|||||||
ret = add_listener_to_source (source, client);
|
ret = add_listener_to_source (source, client);
|
||||||
avl_tree_unlock (global.source_tree);
|
avl_tree_unlock (global.source_tree);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
LOG_DEBUG("client authenticated, passed to source");
|
ICECAST_LOG_DEBUG("client authenticated, passed to source");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -512,12 +512,12 @@ void auth_postprocess_source (auth_client *auth_user)
|
|||||||
client->authenticated = 1;
|
client->authenticated = 1;
|
||||||
if (strcmp (req, "/admin.cgi") == 0 || strncmp ("/admin/metadata", req, 15) == 0)
|
if (strcmp (req, "/admin.cgi") == 0 || strncmp ("/admin/metadata", req, 15) == 0)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("metadata request (%s, %s)", req, mount);
|
ICECAST_LOG_DEBUG("metadata request (%s, %s)", req, mount);
|
||||||
admin_handle_request (client, "/admin/metadata");
|
admin_handle_request (client, "/admin/metadata");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_DEBUG("on mountpoint %s", mount);
|
ICECAST_LOG_DEBUG("on mountpoint %s", mount);
|
||||||
source_startup (client, mount, 0);
|
source_startup (client, mount, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -545,13 +545,13 @@ void auth_add_listener (const char *mount, client_t *client)
|
|||||||
if (mountinfo->auth->pending_count > 100)
|
if (mountinfo->auth->pending_count > 100)
|
||||||
{
|
{
|
||||||
config_release_config ();
|
config_release_config ();
|
||||||
LOG_WARN("too many clients awaiting authentication");
|
ICECAST_LOG_WARN("too many clients awaiting authentication");
|
||||||
client_send_403 (client, "busy, please try again later");
|
client_send_403 (client, "busy, please try again later");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auth_user = auth_client_setup (mount, client);
|
auth_user = auth_client_setup (mount, client);
|
||||||
auth_user->process = auth_new_listener;
|
auth_user->process = auth_new_listener;
|
||||||
LOG_INFO("adding client for authentication");
|
ICECAST_LOG_INFO("adding client for authentication");
|
||||||
queue_auth_client (auth_user, mountinfo);
|
queue_auth_client (auth_user, mountinfo);
|
||||||
config_release_config ();
|
config_release_config ();
|
||||||
}
|
}
|
||||||
@ -595,12 +595,12 @@ static int get_authenticator (auth_t *auth, config_options_t *options)
|
|||||||
{
|
{
|
||||||
if (auth->type == NULL)
|
if (auth->type == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("no authentication type defined");
|
ICECAST_LOG_WARN("no authentication type defined");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
LOG_DEBUG("type is %s", auth->type);
|
ICECAST_LOG_DEBUG("type is %s", auth->type);
|
||||||
|
|
||||||
if (strcmp (auth->type, "url") == 0)
|
if (strcmp (auth->type, "url") == 0)
|
||||||
{
|
{
|
||||||
@ -609,7 +609,7 @@ static int get_authenticator (auth_t *auth, config_options_t *options)
|
|||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
LOG_ERROR("Auth URL disabled");
|
ICECAST_LOG_ERROR("Auth URL disabled");
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -620,7 +620,7 @@ static int get_authenticator (auth_t *auth, config_options_t *options)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_ERROR("Unrecognised authenticator type: \"%s\"", auth->type);
|
ICECAST_LOG_ERROR("Unrecognised authenticator type: \"%s\"", auth->type);
|
||||||
return -1;
|
return -1;
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
@ -669,7 +669,7 @@ auth_t *auth_get_authenticator (xmlNodePtr node)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (xmlStrcmp (current->name, XMLSTR("text")) != 0)
|
if (xmlStrcmp (current->name, XMLSTR("text")) != 0)
|
||||||
LOG_WARN("unknown auth setting (%s)", current->name);
|
ICECAST_LOG_WARN("unknown auth setting (%s)", current->name);
|
||||||
}
|
}
|
||||||
auth->type = (char*)xmlGetProp (node, XMLSTR("type"));
|
auth->type = (char*)xmlGetProp (node, XMLSTR("type"));
|
||||||
if (get_authenticator (auth, options) < 0)
|
if (get_authenticator (auth, options) < 0)
|
||||||
@ -710,7 +710,7 @@ int auth_stream_authenticate (client_t *client, const char *mount, mount_proxy *
|
|||||||
auth_client *auth_user = auth_client_setup (mount, client);
|
auth_client *auth_user = auth_client_setup (mount, client);
|
||||||
|
|
||||||
auth_user->process = stream_auth_callback;
|
auth_user->process = stream_auth_callback;
|
||||||
LOG_INFO("request source auth for \"%s\"", mount);
|
ICECAST_LOG_INFO("request source auth for \"%s\"", mount);
|
||||||
queue_auth_client (auth_user, mountinfo);
|
queue_auth_client (auth_user, mountinfo);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -764,6 +764,6 @@ void auth_initialise (void)
|
|||||||
|
|
||||||
void auth_shutdown (void)
|
void auth_shutdown (void)
|
||||||
{
|
{
|
||||||
LOG_INFO("Auth shutdown");
|
ICECAST_LOG_INFO("Auth shutdown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ static void htpasswd_recheckfile (htpasswd_auth_state *htpasswd)
|
|||||||
return;
|
return;
|
||||||
if (stat (htpasswd->filename, &file_stat) < 0)
|
if (stat (htpasswd->filename, &file_stat) < 0)
|
||||||
{
|
{
|
||||||
LOG_WARN("failed to check status of %s", htpasswd->filename);
|
ICECAST_LOG_WARN("failed to check status of %s", htpasswd->filename);
|
||||||
|
|
||||||
/* Create a dummy users tree for things to use later */
|
/* Create a dummy users tree for things to use later */
|
||||||
thread_rwlock_wlock (&htpasswd->file_rwlock);
|
thread_rwlock_wlock (&htpasswd->file_rwlock);
|
||||||
@ -131,11 +131,11 @@ static void htpasswd_recheckfile (htpasswd_auth_state *htpasswd)
|
|||||||
/* common case, no update to file */
|
/* common case, no update to file */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_INFO("re-reading htpasswd file \"%s\"", htpasswd->filename);
|
ICECAST_LOG_INFO("re-reading htpasswd file \"%s\"", htpasswd->filename);
|
||||||
passwdfile = fopen (htpasswd->filename, "rb");
|
passwdfile = fopen (htpasswd->filename, "rb");
|
||||||
if (passwdfile == NULL)
|
if (passwdfile == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("Failed to open authentication database \"%s\": %s",
|
ICECAST_LOG_WARN("Failed to open authentication database \"%s\": %s",
|
||||||
htpasswd->filename, strerror(errno));
|
htpasswd->filename, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ static void htpasswd_recheckfile (htpasswd_auth_state *htpasswd)
|
|||||||
sep = strrchr (line, ':');
|
sep = strrchr (line, ':');
|
||||||
if (sep == NULL)
|
if (sep == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("No separator on line %d (%s)", num, htpasswd->filename);
|
ICECAST_LOG_WARN("No separator on line %d (%s)", num, htpasswd->filename);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
entry = calloc (1, sizeof (htpasswd_user));
|
entry = calloc (1, sizeof (htpasswd_user));
|
||||||
@ -189,7 +189,7 @@ static auth_result htpasswd_auth (auth_client *auth_user)
|
|||||||
|
|
||||||
if (htpasswd->filename == NULL)
|
if (htpasswd->filename == NULL)
|
||||||
{
|
{
|
||||||
LOG_ERROR("No filename given in options for authenticator.");
|
ICECAST_LOG_ERROR("No filename given in options for authenticator.");
|
||||||
return AUTH_FAILED;
|
return AUTH_FAILED;
|
||||||
}
|
}
|
||||||
htpasswd_recheckfile (htpasswd);
|
htpasswd_recheckfile (htpasswd);
|
||||||
@ -209,10 +209,10 @@ static auth_result htpasswd_auth (auth_client *auth_user)
|
|||||||
return AUTH_OK;
|
return AUTH_OK;
|
||||||
}
|
}
|
||||||
free (hashed_pw);
|
free (hashed_pw);
|
||||||
LOG_DEBUG("incorrect password for client");
|
ICECAST_LOG_DEBUG("incorrect password for client");
|
||||||
return AUTH_FAILED;
|
return AUTH_FAILED;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("no such username: %s", client->username);
|
ICECAST_LOG_DEBUG("no such username: %s", client->username);
|
||||||
thread_rwlock_unlock (&htpasswd->file_rwlock);
|
thread_rwlock_unlock (&htpasswd->file_rwlock);
|
||||||
return AUTH_FAILED;
|
return AUTH_FAILED;
|
||||||
}
|
}
|
||||||
@ -240,10 +240,10 @@ int auth_get_htpasswd_auth (auth_t *authenticator, config_options_t *options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state->filename)
|
if (state->filename)
|
||||||
LOG_INFO("Configured htpasswd authentication using password file \"%s\"",
|
ICECAST_LOG_INFO("Configured htpasswd authentication using password file \"%s\"",
|
||||||
state->filename);
|
state->filename);
|
||||||
else
|
else
|
||||||
LOG_ERROR("No filename given in options for authenticator.");
|
ICECAST_LOG_ERROR("No filename given in options for authenticator.");
|
||||||
|
|
||||||
authenticator->state = state;
|
authenticator->state = state;
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ static auth_result htpasswd_adduser (auth_t *auth, const char *username, const c
|
|||||||
if (passwdfile == NULL)
|
if (passwdfile == NULL)
|
||||||
{
|
{
|
||||||
thread_rwlock_unlock (&state->file_rwlock);
|
thread_rwlock_unlock (&state->file_rwlock);
|
||||||
LOG_WARN("Failed to open authentication database \"%s\": %s",
|
ICECAST_LOG_WARN("Failed to open authentication database \"%s\": %s",
|
||||||
state->filename, strerror(errno));
|
state->filename, strerror(errno));
|
||||||
return AUTH_FAILED;
|
return AUTH_FAILED;
|
||||||
}
|
}
|
||||||
@ -312,7 +312,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
|
|||||||
passwdfile = fopen(state->filename, "rb");
|
passwdfile = fopen(state->filename, "rb");
|
||||||
|
|
||||||
if(passwdfile == NULL) {
|
if(passwdfile == NULL) {
|
||||||
LOG_WARN("Failed to open authentication database \"%s\": %s",
|
ICECAST_LOG_WARN("Failed to open authentication database \"%s\": %s",
|
||||||
state->filename, strerror(errno));
|
state->filename, strerror(errno));
|
||||||
thread_rwlock_unlock (&state->file_rwlock);
|
thread_rwlock_unlock (&state->file_rwlock);
|
||||||
return AUTH_FAILED;
|
return AUTH_FAILED;
|
||||||
@ -322,7 +322,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
|
|||||||
snprintf (tmpfile, tmpfile_len, "%s.tmp", state->filename);
|
snprintf (tmpfile, tmpfile_len, "%s.tmp", state->filename);
|
||||||
if (stat (tmpfile, &file_info) == 0)
|
if (stat (tmpfile, &file_info) == 0)
|
||||||
{
|
{
|
||||||
LOG_WARN("temp file \"%s\" exists, rejecting operation", tmpfile);
|
ICECAST_LOG_WARN("temp file \"%s\" exists, rejecting operation", tmpfile);
|
||||||
free (tmpfile);
|
free (tmpfile);
|
||||||
fclose (passwdfile);
|
fclose (passwdfile);
|
||||||
thread_rwlock_unlock (&state->file_rwlock);
|
thread_rwlock_unlock (&state->file_rwlock);
|
||||||
@ -332,7 +332,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
|
|||||||
tmp_passwdfile = fopen(tmpfile, "wb");
|
tmp_passwdfile = fopen(tmpfile, "wb");
|
||||||
|
|
||||||
if(tmp_passwdfile == NULL) {
|
if(tmp_passwdfile == NULL) {
|
||||||
LOG_WARN("Failed to open temporary authentication database \"%s\": %s",
|
ICECAST_LOG_WARN("Failed to open temporary authentication database \"%s\": %s",
|
||||||
tmpfile, strerror(errno));
|
tmpfile, strerror(errno));
|
||||||
fclose(passwdfile);
|
fclose(passwdfile);
|
||||||
free(tmpfile);
|
free(tmpfile);
|
||||||
@ -347,7 +347,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
|
|||||||
|
|
||||||
sep = strchr(line, ':');
|
sep = strchr(line, ':');
|
||||||
if(sep == NULL) {
|
if(sep == NULL) {
|
||||||
LOG_DEBUG("No separator in line");
|
ICECAST_LOG_DEBUG("No separator in line");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,12 +367,12 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
|
|||||||
/* Windows won't let us rename a file if the destination file
|
/* Windows won't let us rename a file if the destination file
|
||||||
exists...so, lets remove the original first */
|
exists...so, lets remove the original first */
|
||||||
if (remove(state->filename) != 0) {
|
if (remove(state->filename) != 0) {
|
||||||
LOG_ERROR("Problem moving temp authentication file to original \"%s\" - \"%s\": %s",
|
ICECAST_LOG_ERROR("Problem moving temp authentication file to original \"%s\" - \"%s\": %s",
|
||||||
tmpfile, state->filename, strerror(errno));
|
tmpfile, state->filename, strerror(errno));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (rename(tmpfile, state->filename) != 0) {
|
if (rename(tmpfile, state->filename) != 0) {
|
||||||
LOG_ERROR("Problem moving temp authentication file to original \"%s\" - \"%s\": %s",
|
ICECAST_LOG_ERROR("Problem moving temp authentication file to original \"%s\" - \"%s\": %s",
|
||||||
tmpfile, state->filename, strerror(errno));
|
tmpfile, state->filename, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ static void auth_url_clear(auth_t *self)
|
|||||||
{
|
{
|
||||||
auth_url *url;
|
auth_url *url;
|
||||||
|
|
||||||
LOG_INFO("Doing auth URL cleanup");
|
ICECAST_LOG_INFO("Doing auth URL cleanup");
|
||||||
url = self->state;
|
url = self->state;
|
||||||
self->state = NULL;
|
self->state = NULL;
|
||||||
curl_easy_cleanup (url->handle);
|
curl_easy_cleanup (url->handle);
|
||||||
@ -263,7 +263,7 @@ static auth_result url_remove_listener (auth_client *auth_user)
|
|||||||
curl_easy_setopt (url->handle, CURLOPT_WRITEHEADER, auth_user);
|
curl_easy_setopt (url->handle, CURLOPT_WRITEHEADER, auth_user);
|
||||||
|
|
||||||
if (curl_easy_perform (url->handle))
|
if (curl_easy_perform (url->handle))
|
||||||
LOG_WARN("auth to server %s failed with %s", url->removeurl, url->errormsg);
|
ICECAST_LOG_WARN("auth to server %s failed with %s", url->removeurl, url->errormsg);
|
||||||
|
|
||||||
free (userpwd);
|
free (userpwd);
|
||||||
|
|
||||||
@ -394,13 +394,13 @@ static auth_result url_add_listener (auth_client *auth_user)
|
|||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
LOG_WARN("auth to server %s failed with %s", url->addurl, url->errormsg);
|
ICECAST_LOG_WARN("auth to server %s failed with %s", url->addurl, url->errormsg);
|
||||||
return AUTH_FAILED;
|
return AUTH_FAILED;
|
||||||
}
|
}
|
||||||
/* we received a response, lets see what it is */
|
/* we received a response, lets see what it is */
|
||||||
if (client->authenticated)
|
if (client->authenticated)
|
||||||
return AUTH_OK;
|
return AUTH_OK;
|
||||||
LOG_INFO("client auth (%s) failed with \"%s\"", url->addurl, url->errormsg);
|
ICECAST_LOG_INFO("client auth (%s) failed with \"%s\"", url->addurl, url->errormsg);
|
||||||
return AUTH_FAILED;
|
return AUTH_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ static void url_stream_start (auth_client *auth_user)
|
|||||||
curl_easy_setopt (url->handle, CURLOPT_WRITEHEADER, auth_user);
|
curl_easy_setopt (url->handle, CURLOPT_WRITEHEADER, auth_user);
|
||||||
|
|
||||||
if (curl_easy_perform (url->handle))
|
if (curl_easy_perform (url->handle))
|
||||||
LOG_WARN("auth to server %s failed with %s", stream_start_url, url->errormsg);
|
ICECAST_LOG_WARN("auth to server %s failed with %s", stream_start_url, url->errormsg);
|
||||||
|
|
||||||
auth_release (auth);
|
auth_release (auth);
|
||||||
free (stream_start_url);
|
free (stream_start_url);
|
||||||
@ -504,7 +504,7 @@ static void url_stream_end (auth_client *auth_user)
|
|||||||
curl_easy_setopt (url->handle, CURLOPT_WRITEHEADER, auth_user);
|
curl_easy_setopt (url->handle, CURLOPT_WRITEHEADER, auth_user);
|
||||||
|
|
||||||
if (curl_easy_perform (url->handle))
|
if (curl_easy_perform (url->handle))
|
||||||
LOG_WARN("auth to server %s failed with %s", stream_end_url, url->errormsg);
|
ICECAST_LOG_WARN("auth to server %s failed with %s", stream_end_url, url->errormsg);
|
||||||
|
|
||||||
auth_release (auth);
|
auth_release (auth);
|
||||||
free (stream_end_url);
|
free (stream_end_url);
|
||||||
@ -554,7 +554,7 @@ static void url_stream_auth (auth_client *auth_user)
|
|||||||
|
|
||||||
client->authenticated = 0;
|
client->authenticated = 0;
|
||||||
if (curl_easy_perform (url->handle))
|
if (curl_easy_perform (url->handle))
|
||||||
LOG_WARN("auth to server %s failed with %s", url->stream_auth, url->errormsg);
|
ICECAST_LOG_WARN("auth to server %s failed with %s", url->stream_auth, url->errormsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -683,7 +683,7 @@ int auth_get_url_auth (auth_t *authenticator, config_options_t *options)
|
|||||||
snprintf (url_info->userpwd, len, "%s:%s", url_info->username, url_info->password);
|
snprintf (url_info->userpwd, len, "%s:%s", url_info->username, url_info->password);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("URL based authentication setup");
|
ICECAST_LOG_INFO("URL based authentication setup");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ static void _parse_root(xmlDocPtr doc, xmlNodePtr node,
|
|||||||
_parse_authentication(doc, node->xmlChildrenNode, configuration);
|
_parse_authentication(doc, node->xmlChildrenNode, configuration);
|
||||||
} else if (xmlStrcmp (node->name, XMLSTR("source-password")) == 0) {
|
} else if (xmlStrcmp (node->name, XMLSTR("source-password")) == 0) {
|
||||||
/* TODO: This is the backwards-compatibility location */
|
/* TODO: This is the backwards-compatibility location */
|
||||||
LOG_WARN("<source-password> defined outside <authentication>. This is deprecated.");
|
ICECAST_LOG_WARN("<source-password> defined outside <authentication>. This is deprecated.");
|
||||||
if (configuration->source_password) xmlFree(configuration->source_password);
|
if (configuration->source_password) xmlFree(configuration->source_password);
|
||||||
configuration->source_password = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
configuration->source_password = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||||
} else if (xmlStrcmp (node->name, XMLSTR("icelogin")) == 0) {
|
} else if (xmlStrcmp (node->name, XMLSTR("icelogin")) == 0) {
|
||||||
@ -572,7 +572,7 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
|
|||||||
mount->mounttype = MOUNT_TYPE_DEFAULT;
|
mount->mounttype = MOUNT_TYPE_DEFAULT;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_WARN("Unknown mountpoint type: %s", tmp);
|
ICECAST_LOG_WARN("Unknown mountpoint type: %s", tmp);
|
||||||
config_clear_mount (mount);
|
config_clear_mount (mount);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -718,7 +718,7 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
|
|||||||
}
|
}
|
||||||
else if (mount->mountname != NULL && mount->mounttype == MOUNT_TYPE_DEFAULT)
|
else if (mount->mountname != NULL && mount->mounttype == MOUNT_TYPE_DEFAULT)
|
||||||
{
|
{
|
||||||
LOG_WARN("Default mount %s has mount-name set. This is not supported. Behavior may not be consistent.", mount->mountname);
|
ICECAST_LOG_WARN("Default mount %s has mount-name set. This is not supported. Behavior may not be consistent.", mount->mountname);
|
||||||
}
|
}
|
||||||
if (mount->auth && mount->mountname) {
|
if (mount->auth && mount->mountname) {
|
||||||
mount->auth->mount = strdup ((char *)mount->mountname);
|
mount->auth->mount = strdup ((char *)mount->mountname);
|
||||||
@ -732,7 +732,7 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
|
|||||||
|
|
||||||
if (!mount->fallback_mount && (mount->fallback_when_full || mount->fallback_override))
|
if (!mount->fallback_mount && (mount->fallback_when_full || mount->fallback_override))
|
||||||
{
|
{
|
||||||
LOG_WARN("Config for mount %s contains fallback options but no fallback mount.", mount->mountname);
|
ICECAST_LOG_WARN("Config for mount %s contains fallback options but no fallback mount.", mount->mountname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(last)
|
if(last)
|
||||||
@ -896,7 +896,7 @@ static void _parse_authentication(xmlDocPtr doc, xmlNodePtr node,
|
|||||||
|
|
||||||
if (xmlStrcmp (node->name, XMLSTR("source-password")) == 0) {
|
if (xmlStrcmp (node->name, XMLSTR("source-password")) == 0) {
|
||||||
if (xmlGetProp(node, XMLSTR("mount"))) {
|
if (xmlGetProp(node, XMLSTR("mount"))) {
|
||||||
LOG_ERROR("Mount level source password defined within global <authentication> section.");
|
ICECAST_LOG_ERROR("Mount level source password defined within global <authentication> section.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (configuration->source_password)
|
if (configuration->source_password)
|
||||||
@ -934,7 +934,7 @@ static void _parse_directory(xmlDocPtr doc, xmlNodePtr node,
|
|||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
if (configuration->num_yp_directories >= MAX_YP_DIRECTORIES) {
|
if (configuration->num_yp_directories >= MAX_YP_DIRECTORIES) {
|
||||||
LOG_ERROR("Maximum number of yp directories exceeded!");
|
ICECAST_LOG_ERROR("Maximum number of yp directories exceeded!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
@ -65,7 +65,7 @@ int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser)
|
|||||||
|
|
||||||
global.clients++;
|
global.clients++;
|
||||||
if (config->client_limit < global.clients)
|
if (config->client_limit < global.clients)
|
||||||
LOG_WARN("server client limit reached (%d/%d)", config->client_limit, global.clients);
|
ICECAST_LOG_WARN("server client limit reached (%d/%d)", config->client_limit, global.clients);
|
||||||
else
|
else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ int client_read_bytes (client_t *client, void *buf, unsigned len)
|
|||||||
bytes = client->con->read (client->con, buf, len);
|
bytes = client->con->read (client->con, buf, len);
|
||||||
|
|
||||||
if (bytes == -1 && client->con->error)
|
if (bytes == -1 && client->con->error)
|
||||||
LOG_DEBUG("reading from connection has failed");
|
ICECAST_LOG_DEBUG("reading from connection has failed");
|
||||||
|
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
@ -235,7 +235,7 @@ int client_send_bytes (client_t *client, const void *buf, unsigned len)
|
|||||||
int ret = client->con->send (client->con, buf, len);
|
int ret = client->con->send (client->con, buf, len);
|
||||||
|
|
||||||
if (client->con->error)
|
if (client->con->error)
|
||||||
LOG_DEBUG("Client connection died");
|
ICECAST_LOG_DEBUG("Client connection died");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -212,29 +212,29 @@ static void get_ssl_certificate (ice_config_t *config)
|
|||||||
break;
|
break;
|
||||||
if (SSL_CTX_use_certificate_chain_file (ssl_ctx, config->cert_file) <= 0)
|
if (SSL_CTX_use_certificate_chain_file (ssl_ctx, config->cert_file) <= 0)
|
||||||
{
|
{
|
||||||
LOG_WARN("Invalid cert file %s", config->cert_file);
|
ICECAST_LOG_WARN("Invalid cert file %s", config->cert_file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (SSL_CTX_use_PrivateKey_file (ssl_ctx, config->cert_file, SSL_FILETYPE_PEM) <= 0)
|
if (SSL_CTX_use_PrivateKey_file (ssl_ctx, config->cert_file, SSL_FILETYPE_PEM) <= 0)
|
||||||
{
|
{
|
||||||
LOG_WARN("Invalid private key file %s", config->cert_file);
|
ICECAST_LOG_WARN("Invalid private key file %s", config->cert_file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!SSL_CTX_check_private_key (ssl_ctx))
|
if (!SSL_CTX_check_private_key (ssl_ctx))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Invalid %s - Private key does not match cert public key", config->cert_file);
|
ICECAST_LOG_ERROR("Invalid %s - Private key does not match cert public key", config->cert_file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (SSL_CTX_set_cipher_list(ssl_ctx, config->cipher_list) <= 0)
|
if (SSL_CTX_set_cipher_list(ssl_ctx, config->cipher_list) <= 0)
|
||||||
{
|
{
|
||||||
LOG_WARN("Invalid cipher list: %s", config->cipher_list);
|
ICECAST_LOG_WARN("Invalid cipher list: %s", config->cipher_list);
|
||||||
}
|
}
|
||||||
ssl_ok = 1;
|
ssl_ok = 1;
|
||||||
LOG_INFO("SSL certificate found at %s", config->cert_file);
|
ICECAST_LOG_INFO("SSL certificate found at %s", config->cert_file);
|
||||||
LOG_INFO("SSL using ciphers %s", config->cipher_list);
|
ICECAST_LOG_INFO("SSL using ciphers %s", config->cipher_list);
|
||||||
return;
|
return;
|
||||||
} while (0);
|
} while (0);
|
||||||
LOG_INFO("No SSL capability on any configured ports");
|
ICECAST_LOG_INFO("No SSL capability on any configured ports");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ static int connection_send_ssl (connection_t *con, const void *buf, size_t len)
|
|||||||
static void get_ssl_certificate (ice_config_t *config)
|
static void get_ssl_certificate (ice_config_t *config)
|
||||||
{
|
{
|
||||||
ssl_ok = 0;
|
ssl_ok = 0;
|
||||||
LOG_INFO("No SSL capability");
|
ICECAST_LOG_INFO("No SSL capability");
|
||||||
}
|
}
|
||||||
#endif /* HAVE_OPENSSL */
|
#endif /* HAVE_OPENSSL */
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ static void recheck_ip_file (cache_file_contents *cache)
|
|||||||
}
|
}
|
||||||
if (stat (cache->filename, &file_stat) < 0)
|
if (stat (cache->filename, &file_stat) < 0)
|
||||||
{
|
{
|
||||||
LOG_WARN("failed to check status of \"%s\": %s", cache->filename, strerror(errno));
|
ICECAST_LOG_WARN("failed to check status of \"%s\": %s", cache->filename, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (file_stat.st_mtime == cache->file_mtime)
|
if (file_stat.st_mtime == cache->file_mtime)
|
||||||
@ -351,7 +351,7 @@ static void recheck_ip_file (cache_file_contents *cache)
|
|||||||
file = fopen (cache->filename, "r");
|
file = fopen (cache->filename, "r");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("Failed to open file \"%s\": %s", cache->filename, strerror (errno));
|
ICECAST_LOG_WARN("Failed to open file \"%s\": %s", cache->filename, strerror (errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ static void recheck_ip_file (cache_file_contents *cache)
|
|||||||
avl_insert (new_ips, str);
|
avl_insert (new_ips, str);
|
||||||
}
|
}
|
||||||
fclose (file);
|
fclose (file);
|
||||||
LOG_INFO("%d entries read from file \"%s\"", count, cache->filename);
|
ICECAST_LOG_INFO("%d entries read from file \"%s\"", count, cache->filename);
|
||||||
|
|
||||||
if (cache->contents) avl_tree_free (cache->contents, free_filtered_ip);
|
if (cache->contents) avl_tree_free (cache->contents, free_filtered_ip);
|
||||||
cache->contents = new_ips;
|
cache->contents = new_ips;
|
||||||
@ -388,7 +388,7 @@ static int accept_ip_address (char *ip)
|
|||||||
{
|
{
|
||||||
if (avl_get_by_key (banned_ip.contents, ip, &result) == 0)
|
if (avl_get_by_key (banned_ip.contents, ip, &result) == 0)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("%s is banned", ip);
|
ICECAST_LOG_DEBUG("%s is banned", ip);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -396,12 +396,12 @@ static int accept_ip_address (char *ip)
|
|||||||
{
|
{
|
||||||
if (avl_get_by_key (allowed_ip.contents, ip, &result) == 0)
|
if (avl_get_by_key (allowed_ip.contents, ip, &result) == 0)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("%s is allowed", ip);
|
ICECAST_LOG_DEBUG("%s is allowed", ip);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_DEBUG("%s is not allowed", ip);
|
ICECAST_LOG_DEBUG("%s is not allowed", ip);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -469,7 +469,7 @@ static sock_t wait_for_serversock(int timeout)
|
|||||||
if (ufds[i].revents & (POLLHUP|POLLERR))
|
if (ufds[i].revents & (POLLHUP|POLLERR))
|
||||||
{
|
{
|
||||||
sock_close (global.serversock[i]);
|
sock_close (global.serversock[i]);
|
||||||
LOG_WARN("Had to close a listening socket");
|
ICECAST_LOG_WARN("Had to close a listening socket");
|
||||||
}
|
}
|
||||||
global.serversock[i] = SOCK_ERROR;
|
global.serversock[i] = SOCK_ERROR;
|
||||||
}
|
}
|
||||||
@ -553,7 +553,7 @@ static connection_t *_accept_connection(int duration)
|
|||||||
{
|
{
|
||||||
if (!sock_recoverable(sock_error()))
|
if (!sock_recoverable(sock_error()))
|
||||||
{
|
{
|
||||||
LOG_WARN("accept() failed with error %d: %s", sock_error(), strerror(sock_error()));
|
ICECAST_LOG_WARN("accept() failed with error %d: %s", sock_error(), strerror(sock_error()));
|
||||||
thread_sleep (500000);
|
thread_sleep (500000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -740,7 +740,7 @@ void connection_accept_loop (void)
|
|||||||
if (sock_set_blocking (client->con->sock, 0) || sock_set_nodelay (client->con->sock))
|
if (sock_set_blocking (client->con->sock, 0) || sock_set_nodelay (client->con->sock))
|
||||||
{
|
{
|
||||||
global_unlock();
|
global_unlock();
|
||||||
LOG_WARN("failed to set tcp options on client connection, dropping");
|
ICECAST_LOG_WARN("failed to set tcp options on client connection, dropping");
|
||||||
client_destroy (client);
|
client_destroy (client);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -798,7 +798,7 @@ int connection_complete_source (source_t *source, int response)
|
|||||||
ice_config_t *config;
|
ice_config_t *config;
|
||||||
|
|
||||||
global_lock ();
|
global_lock ();
|
||||||
LOG_DEBUG("sources count is %d", global.sources);
|
ICECAST_LOG_DEBUG("sources count is %d", global.sources);
|
||||||
|
|
||||||
config = config_get_config();
|
config = config_get_config();
|
||||||
if (global.sources < config->source_limit)
|
if (global.sources < config->source_limit)
|
||||||
@ -823,13 +823,13 @@ int connection_complete_source (source_t *source, int response)
|
|||||||
client_send_403 (source->client, "Content-type not supported");
|
client_send_403 (source->client, "Content-type not supported");
|
||||||
source->client = NULL;
|
source->client = NULL;
|
||||||
}
|
}
|
||||||
LOG_WARN("Content-type \"%s\" not supported, dropping source", contenttype);
|
ICECAST_LOG_WARN("Content-type \"%s\" not supported, dropping source", contenttype);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_WARN("No content-type header, falling back to backwards compatibility mode "
|
ICECAST_LOG_WARN("No content-type header, falling back to backwards compatibility mode "
|
||||||
"for icecast 1.x relays. Assuming content is mp3.");
|
"for icecast 1.x relays. Assuming content is mp3.");
|
||||||
format_type = FORMAT_TYPE_GENERIC;
|
format_type = FORMAT_TYPE_GENERIC;
|
||||||
}
|
}
|
||||||
@ -843,7 +843,7 @@ int connection_complete_source (source_t *source, int response)
|
|||||||
client_send_403 (source->client, "internal format allocation problem");
|
client_send_403 (source->client, "internal format allocation problem");
|
||||||
source->client = NULL;
|
source->client = NULL;
|
||||||
}
|
}
|
||||||
LOG_WARN("plugin format failed for \"%s\"", source->mount);
|
ICECAST_LOG_WARN("plugin format failed for \"%s\"", source->mount);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -854,7 +854,7 @@ int connection_complete_source (source_t *source, int response)
|
|||||||
#ifdef HAVE_STRCASESTR
|
#ifdef HAVE_STRCASESTR
|
||||||
if (strcasestr (expectcontinue, "100-continue") != NULL)
|
if (strcasestr (expectcontinue, "100-continue") != NULL)
|
||||||
#else
|
#else
|
||||||
LOG_WARN("OS doesn't support case insenestive substring checks...");
|
ICECAST_LOG_WARN("OS doesn't support case insenestive substring checks...");
|
||||||
if (strstr (expectcontinue, "100-continue") != NULL)
|
if (strstr (expectcontinue, "100-continue") != NULL)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -873,11 +873,11 @@ int connection_complete_source (source_t *source, int response)
|
|||||||
slave_rebuild_mounts();
|
slave_rebuild_mounts();
|
||||||
|
|
||||||
source->shutdown_rwlock = &_source_shutdown_rwlock;
|
source->shutdown_rwlock = &_source_shutdown_rwlock;
|
||||||
LOG_DEBUG("source is ready to start");
|
ICECAST_LOG_DEBUG("source is ready to start");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
LOG_WARN("Request to add source when maximum source limit "
|
ICECAST_LOG_WARN("Request to add source when maximum source limit "
|
||||||
"reached %d", global.sources);
|
"reached %d", global.sources);
|
||||||
|
|
||||||
global_unlock();
|
global_unlock();
|
||||||
@ -909,7 +909,7 @@ static int _check_pass_http(http_parser_t *parser,
|
|||||||
|
|
||||||
userpass = util_base64_decode(header+6);
|
userpass = util_base64_decode(header+6);
|
||||||
if(userpass == NULL) {
|
if(userpass == NULL) {
|
||||||
LOG_WARN("Base64 decode of Authorization header \"%s\" failed",
|
ICECAST_LOG_WARN("Base64 decode of Authorization header \"%s\" failed",
|
||||||
header+6);
|
header+6);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1008,7 +1008,7 @@ int connection_check_pass (http_parser_t *parser, const char *user, const char *
|
|||||||
const char *protocol;
|
const char *protocol;
|
||||||
|
|
||||||
if(!pass) {
|
if(!pass) {
|
||||||
LOG_WARN("No source password set, rejecting source");
|
ICECAST_LOG_WARN("No source password set, rejecting source");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1025,7 +1025,7 @@ int connection_check_pass (http_parser_t *parser, const char *user, const char *
|
|||||||
{
|
{
|
||||||
ret = _check_pass_ice(parser, pass);
|
ret = _check_pass_ice(parser, pass);
|
||||||
if(ret)
|
if(ret)
|
||||||
LOG_WARN("Source is using deprecated icecast login");
|
ICECAST_LOG_WARN("Source is using deprecated icecast login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1036,12 +1036,12 @@ int connection_check_pass (http_parser_t *parser, const char *user, const char *
|
|||||||
/* only called for native icecast source clients */
|
/* only called for native icecast source clients */
|
||||||
static void _handle_source_request (client_t *client, const char *uri)
|
static void _handle_source_request (client_t *client, const char *uri)
|
||||||
{
|
{
|
||||||
LOG_INFO("Source logging in at mountpoint \"%s\" from %s",
|
ICECAST_LOG_INFO("Source logging in at mountpoint \"%s\" from %s",
|
||||||
uri, client->con->ip);
|
uri, client->con->ip);
|
||||||
|
|
||||||
if (uri[0] != '/')
|
if (uri[0] != '/')
|
||||||
{
|
{
|
||||||
LOG_WARN("source mountpoint not starting with /");
|
ICECAST_LOG_WARN("source mountpoint not starting with /");
|
||||||
client_send_401 (client);
|
client_send_401 (client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1055,7 +1055,7 @@ static void _handle_source_request (client_t *client, const char *uri)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default: /* failed */
|
default: /* failed */
|
||||||
LOG_INFO("Source (%s) attempted to login with invalid or missing password", uri);
|
ICECAST_LOG_INFO("Source (%s) attempted to login with invalid or missing password", uri);
|
||||||
client_send_401(client);
|
client_send_401(client);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1100,7 +1100,7 @@ void source_startup (client_t *client, const char *uri, int auth_style)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
client_send_403 (client, "Mountpoint in use");
|
client_send_403 (client, "Mountpoint in use");
|
||||||
LOG_WARN("Mountpoint %s in use", uri);
|
ICECAST_LOG_WARN("Mountpoint %s in use", uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1112,7 +1112,7 @@ static void _handle_stats_request (client_t *client, char *uri)
|
|||||||
if (connection_check_admin_pass (client->parser) == 0)
|
if (connection_check_admin_pass (client->parser) == 0)
|
||||||
{
|
{
|
||||||
client_send_401 (client);
|
client_send_401 (client);
|
||||||
LOG_ERROR("Bad password for stats connection");
|
ICECAST_LOG_ERROR("Bad password for stats connection");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1156,7 +1156,7 @@ static void _handle_get_request (client_t *client, char *passed_uri)
|
|||||||
while(alias) {
|
while(alias) {
|
||||||
if(strcmp(uri, alias->source) == 0 && (alias->port == -1 || alias->port == serverport) && (alias->bind_address == NULL || (serverhost != NULL && strcmp(alias->bind_address, serverhost) == 0))) {
|
if(strcmp(uri, alias->source) == 0 && (alias->port == -1 || alias->port == serverport) && (alias->bind_address == NULL || (serverhost != NULL && strcmp(alias->bind_address, serverhost) == 0))) {
|
||||||
uri = strdup (alias->destination);
|
uri = strdup (alias->destination);
|
||||||
LOG_DEBUG("alias has made %s into %s", passed_uri, uri);
|
ICECAST_LOG_DEBUG("alias has made %s into %s", passed_uri, uri);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
alias = alias->next;
|
alias = alias->next;
|
||||||
@ -1248,7 +1248,7 @@ static void _handle_shoutcast_compatible (client_queue_t *node)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LOG_INFO("password does not match \"%s\"", client->refbuf->data);
|
ICECAST_LOG_INFO("password does not match \"%s\"", client->refbuf->data);
|
||||||
client_destroy (client);
|
client_destroy (client);
|
||||||
free (source_password);
|
free (source_password);
|
||||||
free (node->shoutcast_mount);
|
free (node->shoutcast_mount);
|
||||||
@ -1346,7 +1346,7 @@ static void _handle_connection(void)
|
|||||||
|
|
||||||
if (strcmp("ICE", httpp_getvar(parser, HTTPP_VAR_PROTOCOL)) &&
|
if (strcmp("ICE", httpp_getvar(parser, HTTPP_VAR_PROTOCOL)) &&
|
||||||
strcmp("HTTP", httpp_getvar(parser, HTTPP_VAR_PROTOCOL))) {
|
strcmp("HTTP", httpp_getvar(parser, HTTPP_VAR_PROTOCOL))) {
|
||||||
LOG_ERROR("Bad HTTP protocol detected");
|
ICECAST_LOG_ERROR("Bad HTTP protocol detected");
|
||||||
client_destroy (client);
|
client_destroy (client);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1369,7 +1369,7 @@ static void _handle_connection(void)
|
|||||||
_handle_get_request (client, uri);
|
_handle_get_request (client, uri);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_ERROR("Wrong request type from client");
|
ICECAST_LOG_ERROR("Wrong request type from client");
|
||||||
client_send_400 (client, "unknown request");
|
client_send_400 (client, "unknown request");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1378,7 +1378,7 @@ static void _handle_connection(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
free (node);
|
free (node);
|
||||||
LOG_ERROR("HTTP request parsing failed");
|
ICECAST_LOG_ERROR("HTTP request parsing failed");
|
||||||
client_destroy (client);
|
client_destroy (client);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -1450,19 +1450,19 @@ int connection_setup_sockets (ice_config_t *config)
|
|||||||
if (successful == 0)
|
if (successful == 0)
|
||||||
{
|
{
|
||||||
if (listener->bind_address)
|
if (listener->bind_address)
|
||||||
LOG_ERROR("Could not create listener socket on port %d bind %s",
|
ICECAST_LOG_ERROR("Could not create listener socket on port %d bind %s",
|
||||||
listener->port, listener->bind_address);
|
listener->port, listener->bind_address);
|
||||||
else
|
else
|
||||||
LOG_ERROR("Could not create listener socket on port %d", listener->port);
|
ICECAST_LOG_ERROR("Could not create listener socket on port %d", listener->port);
|
||||||
/* remove failed connection */
|
/* remove failed connection */
|
||||||
*prev = config_clear_listener (listener);
|
*prev = config_clear_listener (listener);
|
||||||
listener = *prev;
|
listener = *prev;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (listener->bind_address)
|
if (listener->bind_address)
|
||||||
LOG_INFO("listener socket on port %d address %s", listener->port, listener->bind_address);
|
ICECAST_LOG_INFO("listener socket on port %d address %s", listener->port, listener->bind_address);
|
||||||
else
|
else
|
||||||
LOG_INFO("listener socket on port %d", listener->port);
|
ICECAST_LOG_INFO("listener socket on port %d", listener->port);
|
||||||
prev = &listener->next;
|
prev = &listener->next;
|
||||||
listener = listener->next;
|
listener = listener->next;
|
||||||
}
|
}
|
||||||
@ -1470,7 +1470,7 @@ int connection_setup_sockets (ice_config_t *config)
|
|||||||
global_unlock();
|
global_unlock();
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
LOG_ERROR("No listening sockets established");
|
ICECAST_LOG_ERROR("No listening sockets established");
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
10
src/event.c
10
src/event.c
@ -40,20 +40,20 @@ void event_config_read(void *arg)
|
|||||||
xmlSetGenericErrorFunc ("config", log_parse_failure);
|
xmlSetGenericErrorFunc ("config", log_parse_failure);
|
||||||
ret = config_parse_file(config->config_filename, &new_config);
|
ret = config_parse_file(config->config_filename, &new_config);
|
||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
LOG_ERROR("Error parsing config, not replacing existing config");
|
ICECAST_LOG_ERROR("Error parsing config, not replacing existing config");
|
||||||
switch(ret) {
|
switch(ret) {
|
||||||
case CONFIG_EINSANE:
|
case CONFIG_EINSANE:
|
||||||
LOG_ERROR("Config filename null or blank");
|
ICECAST_LOG_ERROR("Config filename null or blank");
|
||||||
break;
|
break;
|
||||||
case CONFIG_ENOROOT:
|
case CONFIG_ENOROOT:
|
||||||
LOG_ERROR("Root element not found in %s", config->config_filename);
|
ICECAST_LOG_ERROR("Root element not found in %s", config->config_filename);
|
||||||
break;
|
break;
|
||||||
case CONFIG_EBADROOT:
|
case CONFIG_EBADROOT:
|
||||||
LOG_ERROR("Not an icecast2 config file: %s",
|
ICECAST_LOG_ERROR("Not an icecast2 config file: %s",
|
||||||
config->config_filename);
|
config->config_filename);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR("Parse error in reading %s", config->config_filename);
|
ICECAST_LOG_ERROR("Parse error in reading %s", config->config_filename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
config_release_config();
|
config_release_config();
|
||||||
|
@ -79,7 +79,7 @@ format_type_t format_get_type (const char *contenttype)
|
|||||||
/* We default to the Generic format handler, which
|
/* We default to the Generic format handler, which
|
||||||
can handle many more formats than just mp3.
|
can handle many more formats than just mp3.
|
||||||
Let's warn that this is not well supported */
|
Let's warn that this is not well supported */
|
||||||
LOG_WARN("Unsupported or legacy stream type: \"%s\". Falling back to generic minimal handler for best effort.", contenttype);
|
ICECAST_LOG_WARN("Unsupported or legacy stream type: \"%s\". Falling back to generic minimal handler for best effort.", contenttype);
|
||||||
return FORMAT_TYPE_GENERIC;
|
return FORMAT_TYPE_GENERIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,11 +221,11 @@ int format_check_http_buffer (source_t *source, client_t *client)
|
|||||||
|
|
||||||
if (client->respcode == 0)
|
if (client->respcode == 0)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("processing pending client headers");
|
ICECAST_LOG_DEBUG("processing pending client headers");
|
||||||
|
|
||||||
if (format_prepare_headers (source, client) < 0)
|
if (format_prepare_headers (source, client) < 0)
|
||||||
{
|
{
|
||||||
LOG_ERROR("internal problem, dropping client");
|
ICECAST_LOG_ERROR("internal problem, dropping client");
|
||||||
client->con->error = 1;
|
client->con->error = 1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ static refbuf_t *ebml_get_buffer (source_t *source)
|
|||||||
format->read_bytes += bytes;
|
format->read_bytes += bytes;
|
||||||
ret = ebml_wrote (ebml_source_state->ebml, bytes);
|
ret = ebml_wrote (ebml_source_state->ebml, bytes);
|
||||||
if (ret != bytes) {
|
if (ret != bytes) {
|
||||||
LOG_ERROR("Problem processing stream");
|
ICECAST_LOG_ERROR("Problem processing stream");
|
||||||
source->running = 0;
|
source->running = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ static void ebml_free_client_data (client_t *client)
|
|||||||
|
|
||||||
static void ebml_write_buf_to_file_fail (source_t *source)
|
static void ebml_write_buf_to_file_fail (source_t *source)
|
||||||
{
|
{
|
||||||
LOG_WARN("Write to dump file failed, disabling");
|
ICECAST_LOG_WARN("Write to dump file failed, disabling");
|
||||||
fclose (source->dumpfile);
|
fclose (source->dumpfile);
|
||||||
source->dumpfile = NULL;
|
source->dumpfile = NULL;
|
||||||
}
|
}
|
||||||
@ -420,7 +420,7 @@ static int ebml_wrote(ebml_t *ebml, int len)
|
|||||||
{
|
{
|
||||||
if ((ebml->header_position + len) > EBML_HEADER_MAX_SIZE)
|
if ((ebml->header_position + len) > EBML_HEADER_MAX_SIZE)
|
||||||
{
|
{
|
||||||
LOG_ERROR("EBML Header too large, failing");
|
ICECAST_LOG_ERROR("EBML Header too large, failing");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ typedef struct source_tag source_t;
|
|||||||
|
|
||||||
static void flac_codec_free (ogg_state_t *ogg_info, ogg_codec_t *codec)
|
static void flac_codec_free (ogg_state_t *ogg_info, ogg_codec_t *codec)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("freeing FLAC codec");
|
ICECAST_LOG_DEBUG("freeing FLAC codec");
|
||||||
stats_event (ogg_info->mount, "FLAC_version", NULL);
|
stats_event (ogg_info->mount, "FLAC_version", NULL);
|
||||||
ogg_stream_clear (&codec->os);
|
ogg_stream_clear (&codec->os);
|
||||||
free (codec);
|
free (codec);
|
||||||
@ -93,7 +93,7 @@ ogg_codec_t *initial_flac_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
|
|
||||||
ogg_stream_packetout (&codec->os, &packet);
|
ogg_stream_packetout (&codec->os, &packet);
|
||||||
|
|
||||||
LOG_DEBUG("checking for FLAC codec");
|
ICECAST_LOG_DEBUG("checking for FLAC codec");
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
unsigned char *parse = packet.packet;
|
unsigned char *parse = packet.packet;
|
||||||
@ -106,7 +106,7 @@ ogg_codec_t *initial_flac_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
if (memcmp (parse, "FLAC", 4) != 0)
|
if (memcmp (parse, "FLAC", 4) != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
LOG_INFO("seen initial FLAC header");
|
ICECAST_LOG_INFO("seen initial FLAC header");
|
||||||
|
|
||||||
parse += 4;
|
parse += 4;
|
||||||
stats_event_args (ogg_info->mount, "FLAC_version", "%d.%d", parse[0], parse[1]);
|
stats_event_args (ogg_info->mount, "FLAC_version", "%d.%d", parse[0], parse[1]);
|
||||||
|
@ -54,7 +54,7 @@ static void kate_codec_free (ogg_state_t *ogg_info, ogg_codec_t *codec)
|
|||||||
{
|
{
|
||||||
kate_codec_t *kate = codec->specific;
|
kate_codec_t *kate = codec->specific;
|
||||||
|
|
||||||
LOG_DEBUG("freeing kate codec");
|
ICECAST_LOG_DEBUG("freeing kate codec");
|
||||||
/* TODO: should i replace with something or just remove
|
/* TODO: should i replace with something or just remove
|
||||||
stats_event (ogg_info->mount, "video_bitrate", NULL);
|
stats_event (ogg_info->mount, "video_bitrate", NULL);
|
||||||
stats_event (ogg_info->mount, "video_quality", NULL);
|
stats_event (ogg_info->mount, "video_quality", NULL);
|
||||||
@ -98,7 +98,7 @@ static refbuf_t *process_kate_page (ogg_state_t *ogg_info, ogg_codec_t *codec, o
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ogg_info->error = 1;
|
ogg_info->error = 1;
|
||||||
LOG_WARN("problem with kate header");
|
ICECAST_LOG_WARN("problem with kate header");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
header_page = 1;
|
header_page = 1;
|
||||||
@ -139,7 +139,7 @@ static refbuf_t *process_kate_page (ogg_state_t *ogg_info, ogg_codec_t *codec, o
|
|||||||
if (codec->headers < kate->num_headers)
|
if (codec->headers < kate->num_headers)
|
||||||
{
|
{
|
||||||
ogg_info->error = 1;
|
ogg_info->error = 1;
|
||||||
LOG_ERROR("Not enough header packets");
|
ICECAST_LOG_ERROR("Not enough header packets");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ static refbuf_t *process_kate_page (ogg_state_t *ogg_info, ogg_codec_t *codec, o
|
|||||||
}
|
}
|
||||||
|
|
||||||
refbuf = make_refbuf_with_page (page);
|
refbuf = make_refbuf_with_page (page);
|
||||||
/* LOG_DEBUG("refbuf %p has pageno %ld, %llu", refbuf, ogg_page_pageno (page), (uint64_t)granulepos); */
|
/* ICECAST_LOG_DEBUG("refbuf %p has pageno %ld, %llu", refbuf, ogg_page_pageno (page), (uint64_t)granulepos); */
|
||||||
|
|
||||||
if (codec->possible_start)
|
if (codec->possible_start)
|
||||||
{
|
{
|
||||||
@ -196,7 +196,7 @@ ogg_codec_t *initial_kate_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
|
|
||||||
ogg_stream_packetout (&codec->os, &packet);
|
ogg_stream_packetout (&codec->os, &packet);
|
||||||
|
|
||||||
LOG_DEBUG("checking for kate codec");
|
ICECAST_LOG_DEBUG("checking for kate codec");
|
||||||
#ifdef HAVE_KATE
|
#ifdef HAVE_KATE
|
||||||
if (kate_ogg_decode_headerin (&kate_codec->ki, &kate_codec->kc, &packet) < 0)
|
if (kate_ogg_decode_headerin (&kate_codec->ki, &kate_codec->kc, &packet) < 0)
|
||||||
{
|
{
|
||||||
@ -218,7 +218,7 @@ ogg_codec_t *initial_kate_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOG_INFO("seen initial kate header");
|
ICECAST_LOG_INFO("seen initial kate header");
|
||||||
codec->specific = kate_codec;
|
codec->specific = kate_codec;
|
||||||
codec->process_page = process_kate_page;
|
codec->process_page = process_kate_page;
|
||||||
codec->codec_free = kate_codec_free;
|
codec->codec_free = kate_codec_free;
|
||||||
|
@ -34,7 +34,7 @@ typedef struct source_tag source_t;
|
|||||||
|
|
||||||
static void midi_codec_free (ogg_state_t *ogg_info, ogg_codec_t *codec)
|
static void midi_codec_free (ogg_state_t *ogg_info, ogg_codec_t *codec)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("freeing MIDI codec");
|
ICECAST_LOG_DEBUG("freeing MIDI codec");
|
||||||
ogg_stream_clear (&codec->os);
|
ogg_stream_clear (&codec->os);
|
||||||
free (codec);
|
free (codec);
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ ogg_codec_t *initial_midi_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
|
|
||||||
ogg_stream_packetout (&codec->os, &packet);
|
ogg_stream_packetout (&codec->os, &packet);
|
||||||
|
|
||||||
LOG_DEBUG("checking for MIDI codec");
|
ICECAST_LOG_DEBUG("checking for MIDI codec");
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (packet.bytes < 9)
|
if (packet.bytes < 9)
|
||||||
@ -78,7 +78,7 @@ ogg_codec_t *initial_midi_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
if (packet.bytes != 12)
|
if (packet.bytes != 12)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
LOG_INFO("seen initial MIDI header");
|
ICECAST_LOG_INFO("seen initial MIDI header");
|
||||||
codec->process_page = process_midi_page;
|
codec->process_page = process_midi_page;
|
||||||
codec->codec_free = midi_codec_free;
|
codec->codec_free = midi_codec_free;
|
||||||
codec->headers = 1;
|
codec->headers = 1;
|
||||||
|
@ -227,8 +227,8 @@ static void format_mp3_apply_settings (client_t *client, format_plugin_t *format
|
|||||||
if (format->charset == NULL)
|
if (format->charset == NULL)
|
||||||
format->charset = strdup ("ISO8859-1");
|
format->charset = strdup ("ISO8859-1");
|
||||||
|
|
||||||
LOG_DEBUG("sending metadata interval %d", source_mp3->interval);
|
ICECAST_LOG_DEBUG("sending metadata interval %d", source_mp3->interval);
|
||||||
LOG_DEBUG("charset %s", format->charset);
|
ICECAST_LOG_DEBUG("charset %s", format->charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ static void mp3_set_title (source_t *source)
|
|||||||
if (len > MAX_META_LEN)
|
if (len > MAX_META_LEN)
|
||||||
{
|
{
|
||||||
thread_mutex_unlock (&source_mp3->url_lock);
|
thread_mutex_unlock (&source_mp3->url_lock);
|
||||||
LOG_WARN("Metadata too long at %d chars", len);
|
ICECAST_LOG_WARN("Metadata too long at %d chars", len);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* work out the metadata len byte */
|
/* work out the metadata len byte */
|
||||||
@ -302,7 +302,7 @@ static void mp3_set_title (source_t *source)
|
|||||||
else if (source_mp3->url)
|
else if (source_mp3->url)
|
||||||
snprintf (p->data+r, size-r, "StreamUrl='%s';", source_mp3->url);
|
snprintf (p->data+r, size-r, "StreamUrl='%s';", source_mp3->url);
|
||||||
}
|
}
|
||||||
LOG_DEBUG("shoutcast metadata block setup with %s", p->data+1);
|
ICECAST_LOG_DEBUG("shoutcast metadata block setup with %s", p->data+1);
|
||||||
filter_shoutcast_metadata (source, p->data, size);
|
filter_shoutcast_metadata (source, p->data, size);
|
||||||
|
|
||||||
refbuf_release (source_mp3->metadata);
|
refbuf_release (source_mp3->metadata);
|
||||||
@ -621,7 +621,7 @@ static refbuf_t *mp3_get_filter_meta (source_t *source)
|
|||||||
memcpy (meta->data, source_mp3->build_metadata,
|
memcpy (meta->data, source_mp3->build_metadata,
|
||||||
source_mp3->build_metadata_len);
|
source_mp3->build_metadata_len);
|
||||||
|
|
||||||
LOG_DEBUG("shoutcast metadata %.*s", 4080, meta->data+1);
|
ICECAST_LOG_DEBUG("shoutcast metadata %.*s", 4080, meta->data+1);
|
||||||
if (strncmp (meta->data+1, "StreamTitle=", 12) == 0)
|
if (strncmp (meta->data+1, "StreamTitle=", 12) == 0)
|
||||||
{
|
{
|
||||||
filter_shoutcast_metadata (source, source_mp3->build_metadata,
|
filter_shoutcast_metadata (source, source_mp3->build_metadata,
|
||||||
@ -632,7 +632,7 @@ static refbuf_t *mp3_get_filter_meta (source_t *source)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_ERROR("Incorrect metadata format, ending stream");
|
ICECAST_LOG_ERROR("Incorrect metadata format, ending stream");
|
||||||
source->running = 0;
|
source->running = 0;
|
||||||
refbuf_release (refbuf);
|
refbuf_release (refbuf);
|
||||||
refbuf_release (meta);
|
refbuf_release (meta);
|
||||||
@ -724,7 +724,7 @@ static void write_mp3_to_file (struct source_tag *source, refbuf_t *refbuf)
|
|||||||
return;
|
return;
|
||||||
if (fwrite (refbuf->data, 1, refbuf->len, source->dumpfile) < (size_t)refbuf->len)
|
if (fwrite (refbuf->data, 1, refbuf->len, source->dumpfile) < (size_t)refbuf->len)
|
||||||
{
|
{
|
||||||
LOG_WARN("Write to dump file failed, disabling");
|
ICECAST_LOG_WARN("Write to dump file failed, disabling");
|
||||||
fclose (source->dumpfile);
|
fclose (source->dumpfile);
|
||||||
source->dumpfile = NULL;
|
source->dumpfile = NULL;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ void format_ogg_attach_header (ogg_state_t *ogg_info, ogg_page *page)
|
|||||||
|
|
||||||
if (ogg_page_bos (page))
|
if (ogg_page_bos (page))
|
||||||
{
|
{
|
||||||
LOG_DEBUG("attaching BOS page");
|
ICECAST_LOG_DEBUG("attaching BOS page");
|
||||||
if (*ogg_info->bos_end == NULL)
|
if (*ogg_info->bos_end == NULL)
|
||||||
ogg_info->header_pages_tail = refbuf;
|
ogg_info->header_pages_tail = refbuf;
|
||||||
refbuf->next = *ogg_info->bos_end;
|
refbuf->next = *ogg_info->bos_end;
|
||||||
@ -100,7 +100,7 @@ void format_ogg_attach_header (ogg_state_t *ogg_info, ogg_page *page)
|
|||||||
ogg_info->bos_end = &refbuf->next;
|
ogg_info->bos_end = &refbuf->next;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("attaching header page");
|
ICECAST_LOG_DEBUG("attaching header page");
|
||||||
if (ogg_info->header_pages_tail)
|
if (ogg_info->header_pages_tail)
|
||||||
ogg_info->header_pages_tail->next = refbuf;
|
ogg_info->header_pages_tail->next = refbuf;
|
||||||
ogg_info->header_pages_tail = refbuf;
|
ogg_info->header_pages_tail = refbuf;
|
||||||
@ -115,7 +115,7 @@ void format_ogg_free_headers (ogg_state_t *ogg_info)
|
|||||||
refbuf_t *header;
|
refbuf_t *header;
|
||||||
|
|
||||||
/* release the header pages first */
|
/* release the header pages first */
|
||||||
LOG_DEBUG("releasing header pages");
|
ICECAST_LOG_DEBUG("releasing header pages");
|
||||||
header = ogg_info->header_pages;
|
header = ogg_info->header_pages;
|
||||||
while (header)
|
while (header)
|
||||||
{
|
{
|
||||||
@ -141,7 +141,7 @@ static void free_ogg_codecs (ogg_state_t *ogg_info)
|
|||||||
|
|
||||||
/* now free the codecs */
|
/* now free the codecs */
|
||||||
codec = ogg_info->codecs;
|
codec = ogg_info->codecs;
|
||||||
LOG_DEBUG("freeing codecs");
|
ICECAST_LOG_DEBUG("freeing codecs");
|
||||||
while (codec)
|
while (codec)
|
||||||
{
|
{
|
||||||
ogg_codec_t *next = codec->next;
|
ogg_codec_t *next = codec->next;
|
||||||
@ -219,7 +219,7 @@ static int process_initial_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
{
|
{
|
||||||
if (ogg_info->codec_count > 10)
|
if (ogg_info->codec_count > 10)
|
||||||
{
|
{
|
||||||
LOG_ERROR("many codecs in stream, playing safe, dropping source");
|
ICECAST_LOG_ERROR("many codecs in stream, playing safe, dropping source");
|
||||||
ogg_info->error = 1;
|
ogg_info->error = 1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ static int process_initial_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* any others */
|
/* any others */
|
||||||
LOG_ERROR("Seen BOS page with unknown type");
|
ICECAST_LOG_ERROR("Seen BOS page with unknown type");
|
||||||
ogg_info->error = 1;
|
ogg_info->error = 1;
|
||||||
return -1;
|
return -1;
|
||||||
} while (0);
|
} while (0);
|
||||||
@ -430,7 +430,7 @@ static refbuf_t *ogg_get_buffer (source_t *source)
|
|||||||
}
|
}
|
||||||
if (ogg_info->error)
|
if (ogg_info->error)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Problem processing stream");
|
ICECAST_LOG_ERROR("Problem processing stream");
|
||||||
source->running = 0;
|
source->running = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -564,7 +564,7 @@ static int write_ogg_data (struct source_tag *source, refbuf_t *refbuf)
|
|||||||
|
|
||||||
if (fwrite (refbuf->data, 1, refbuf->len, source->dumpfile) != refbuf->len)
|
if (fwrite (refbuf->data, 1, refbuf->len, source->dumpfile) != refbuf->len)
|
||||||
{
|
{
|
||||||
LOG_WARN("Write to dump file failed, disabling");
|
ICECAST_LOG_WARN("Write to dump file failed, disabling");
|
||||||
fclose (source->dumpfile);
|
fclose (source->dumpfile);
|
||||||
source->dumpfile = NULL;
|
source->dumpfile = NULL;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -70,14 +70,14 @@ ogg_codec_t *initial_opus_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
|
|
||||||
ogg_stream_packetout (&codec->os, &packet);
|
ogg_stream_packetout (&codec->os, &packet);
|
||||||
|
|
||||||
LOG_DEBUG("checking for opus codec");
|
ICECAST_LOG_DEBUG("checking for opus codec");
|
||||||
if (strncmp((char *)packet.packet, "OpusHead", 8) != 0)
|
if (strncmp((char *)packet.packet, "OpusHead", 8) != 0)
|
||||||
{
|
{
|
||||||
ogg_stream_clear (&codec->os);
|
ogg_stream_clear (&codec->os);
|
||||||
free (codec);
|
free (codec);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
LOG_INFO("seen initial opus header");
|
ICECAST_LOG_INFO("seen initial opus header");
|
||||||
codec->process_page = process_opus_page;
|
codec->process_page = process_opus_page;
|
||||||
codec->codec_free = opus_codec_free;
|
codec->codec_free = opus_codec_free;
|
||||||
codec->headers = 1;
|
codec->headers = 1;
|
||||||
|
@ -35,7 +35,7 @@ typedef struct source_tag source_t;
|
|||||||
|
|
||||||
static void skeleton_codec_free (ogg_state_t *ogg_info, ogg_codec_t *codec)
|
static void skeleton_codec_free (ogg_state_t *ogg_info, ogg_codec_t *codec)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("freeing skeleton codec");
|
ICECAST_LOG_DEBUG("freeing skeleton codec");
|
||||||
ogg_stream_clear (&codec->os);
|
ogg_stream_clear (&codec->os);
|
||||||
free (codec);
|
free (codec);
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ ogg_codec_t *initial_skeleton_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
|
|
||||||
ogg_stream_packetout (&codec->os, &packet);
|
ogg_stream_packetout (&codec->os, &packet);
|
||||||
|
|
||||||
LOG_DEBUG("checking for skeleton codec");
|
ICECAST_LOG_DEBUG("checking for skeleton codec");
|
||||||
|
|
||||||
if ((packet.bytes<8) || memcmp(packet.packet, "fishead\0", 8))
|
if ((packet.bytes<8) || memcmp(packet.packet, "fishead\0", 8))
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@ ogg_codec_t *initial_skeleton_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("seen initial skeleton header");
|
ICECAST_LOG_INFO("seen initial skeleton header");
|
||||||
codec->process_page = process_skeleton_page;
|
codec->process_page = process_skeleton_page;
|
||||||
codec->codec_free = skeleton_codec_free;
|
codec->codec_free = skeleton_codec_free;
|
||||||
codec->headers = 1;
|
codec->headers = 1;
|
||||||
|
@ -73,7 +73,7 @@ ogg_codec_t *initial_speex_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
|
|
||||||
ogg_stream_packetout (&codec->os, &packet);
|
ogg_stream_packetout (&codec->os, &packet);
|
||||||
|
|
||||||
LOG_DEBUG("checking for speex codec");
|
ICECAST_LOG_DEBUG("checking for speex codec");
|
||||||
header = speex_packet_to_header ((char*)packet.packet, packet.bytes);
|
header = speex_packet_to_header ((char*)packet.packet, packet.bytes);
|
||||||
if (header == NULL)
|
if (header == NULL)
|
||||||
{
|
{
|
||||||
@ -82,7 +82,7 @@ ogg_codec_t *initial_speex_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
free (codec);
|
free (codec);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
LOG_INFO("seen initial speex header");
|
ICECAST_LOG_INFO("seen initial speex header");
|
||||||
codec->process_page = process_speex_page;
|
codec->process_page = process_speex_page;
|
||||||
codec->codec_free = speex_codec_free;
|
codec->codec_free = speex_codec_free;
|
||||||
codec->headers = 1;
|
codec->headers = 1;
|
||||||
|
@ -47,7 +47,7 @@ static void theora_codec_free (ogg_state_t *ogg_info, ogg_codec_t *codec)
|
|||||||
{
|
{
|
||||||
theora_codec_t *theora = codec->specific;
|
theora_codec_t *theora = codec->specific;
|
||||||
|
|
||||||
LOG_DEBUG("freeing theora codec");
|
ICECAST_LOG_DEBUG("freeing theora codec");
|
||||||
stats_event (ogg_info->mount, "video_bitrate", NULL);
|
stats_event (ogg_info->mount, "video_bitrate", NULL);
|
||||||
stats_event (ogg_info->mount, "video_quality", NULL);
|
stats_event (ogg_info->mount, "video_quality", NULL);
|
||||||
stats_event (ogg_info->mount, "frame_rate", NULL);
|
stats_event (ogg_info->mount, "frame_rate", NULL);
|
||||||
@ -86,7 +86,7 @@ static refbuf_t *process_theora_page (ogg_state_t *ogg_info, ogg_codec_t *codec,
|
|||||||
if (theora_decode_header (&theora->ti, &theora->tc, &packet) < 0)
|
if (theora_decode_header (&theora->ti, &theora->tc, &packet) < 0)
|
||||||
{
|
{
|
||||||
ogg_info->error = 1;
|
ogg_info->error = 1;
|
||||||
LOG_WARN("problem with theora header");
|
ICECAST_LOG_WARN("problem with theora header");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
header_page = 1;
|
header_page = 1;
|
||||||
@ -109,7 +109,7 @@ static refbuf_t *process_theora_page (ogg_state_t *ogg_info, ogg_codec_t *codec,
|
|||||||
if (codec->headers < 3)
|
if (codec->headers < 3)
|
||||||
{
|
{
|
||||||
ogg_info->error = 1;
|
ogg_info->error = 1;
|
||||||
LOG_ERROR("Not enough header packets");
|
ICECAST_LOG_ERROR("Not enough header packets");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (theora_packet_iskeyframe (&packet))
|
if (theora_packet_iskeyframe (&packet))
|
||||||
@ -122,7 +122,7 @@ static refbuf_t *process_theora_page (ogg_state_t *ogg_info, ogg_codec_t *codec,
|
|||||||
}
|
}
|
||||||
|
|
||||||
refbuf = make_refbuf_with_page (page);
|
refbuf = make_refbuf_with_page (page);
|
||||||
/* LOG_DEBUG("refbuf %p has pageno %ld, %llu", refbuf, ogg_page_pageno (page), (uint64_t)granulepos); */
|
/* ICECAST_LOG_DEBUG("refbuf %p has pageno %ld, %llu", refbuf, ogg_page_pageno (page), (uint64_t)granulepos); */
|
||||||
|
|
||||||
if (granulepos != theora->prev_granulepos || granulepos == 0)
|
if (granulepos != theora->prev_granulepos || granulepos == 0)
|
||||||
{
|
{
|
||||||
@ -162,7 +162,7 @@ ogg_codec_t *initial_theora_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
|
|
||||||
ogg_stream_packetout (&codec->os, &packet);
|
ogg_stream_packetout (&codec->os, &packet);
|
||||||
|
|
||||||
LOG_DEBUG("checking for theora codec");
|
ICECAST_LOG_DEBUG("checking for theora codec");
|
||||||
if (theora_decode_header (&theora_codec->ti, &theora_codec->tc, &packet) < 0)
|
if (theora_decode_header (&theora_codec->ti, &theora_codec->tc, &packet) < 0)
|
||||||
{
|
{
|
||||||
theora_info_clear (&theora_codec->ti);
|
theora_info_clear (&theora_codec->ti);
|
||||||
@ -172,7 +172,7 @@ ogg_codec_t *initial_theora_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
free (codec);
|
free (codec);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
LOG_INFO("seen initial theora header");
|
ICECAST_LOG_INFO("seen initial theora header");
|
||||||
codec->specific = theora_codec;
|
codec->specific = theora_codec;
|
||||||
codec->process_page = process_theora_page;
|
codec->process_page = process_theora_page;
|
||||||
codec->codec_free = theora_codec_free;
|
codec->codec_free = theora_codec_free;
|
||||||
|
@ -84,7 +84,7 @@ static void vorbis_codec_free (ogg_state_t *ogg_info, ogg_codec_t *codec)
|
|||||||
{
|
{
|
||||||
vorbis_codec_t *vorbis = codec->specific;
|
vorbis_codec_t *vorbis = codec->specific;
|
||||||
|
|
||||||
LOG_DEBUG("freeing vorbis codec");
|
ICECAST_LOG_DEBUG("freeing vorbis codec");
|
||||||
stats_event (ogg_info->mount, "audio_bitrate", NULL);
|
stats_event (ogg_info->mount, "audio_bitrate", NULL);
|
||||||
stats_event (ogg_info->mount, "audio_channels", NULL);
|
stats_event (ogg_info->mount, "audio_channels", NULL);
|
||||||
stats_event (ogg_info->mount, "audio_samplerate", NULL);
|
stats_event (ogg_info->mount, "audio_samplerate", NULL);
|
||||||
@ -195,7 +195,7 @@ static refbuf_t *get_buffer_finished (ogg_state_t *ogg_info, ogg_codec_t *codec)
|
|||||||
source_vorbis->prev_page_samples = ogg_page_granulepos (&page);
|
source_vorbis->prev_page_samples = ogg_page_granulepos (&page);
|
||||||
|
|
||||||
refbuf = make_refbuf_with_page (&page);
|
refbuf = make_refbuf_with_page (&page);
|
||||||
LOG_DEBUG("flushing page");
|
ICECAST_LOG_DEBUG("flushing page");
|
||||||
return refbuf;
|
return refbuf;
|
||||||
}
|
}
|
||||||
ogg_stream_clear (&source_vorbis->new_os);
|
ogg_stream_clear (&source_vorbis->new_os);
|
||||||
@ -221,7 +221,7 @@ static void initiate_flush (vorbis_codec_t *source_vorbis)
|
|||||||
if (source_vorbis->prev_packet)
|
if (source_vorbis->prev_packet)
|
||||||
{
|
{
|
||||||
/* insert prev_packet with eos */
|
/* insert prev_packet with eos */
|
||||||
LOG_DEBUG("adding EOS packet");
|
ICECAST_LOG_DEBUG("adding EOS packet");
|
||||||
source_vorbis->prev_packet->e_o_s = 1;
|
source_vorbis->prev_packet->e_o_s = 1;
|
||||||
add_audio_packet (source_vorbis, source_vorbis->prev_packet);
|
add_audio_packet (source_vorbis, source_vorbis->prev_packet);
|
||||||
source_vorbis->prev_packet->e_o_s = 0;
|
source_vorbis->prev_packet->e_o_s = 0;
|
||||||
@ -318,7 +318,7 @@ static int process_vorbis_headers (ogg_state_t *ogg_info, ogg_codec_t *codec)
|
|||||||
if (source_vorbis->header [0] == NULL)
|
if (source_vorbis->header [0] == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
LOG_DEBUG("Adding the 3 header packets");
|
ICECAST_LOG_DEBUG("Adding the 3 header packets");
|
||||||
ogg_stream_packetin (&source_vorbis->new_os, source_vorbis->header [0]);
|
ogg_stream_packetin (&source_vorbis->new_os, source_vorbis->header [0]);
|
||||||
/* NOTE: we could build a separate comment packet each time */
|
/* NOTE: we could build a separate comment packet each time */
|
||||||
if (source_vorbis->rebuild_comment)
|
if (source_vorbis->rebuild_comment)
|
||||||
@ -373,7 +373,7 @@ ogg_codec_t *initial_vorbis_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
|
|
||||||
ogg_stream_packetout (&codec->os, &packet);
|
ogg_stream_packetout (&codec->os, &packet);
|
||||||
|
|
||||||
LOG_DEBUG("checking for vorbis codec");
|
ICECAST_LOG_DEBUG("checking for vorbis codec");
|
||||||
if (vorbis_synthesis_headerin (&vorbis->vi, &vorbis->vc, &packet) < 0)
|
if (vorbis_synthesis_headerin (&vorbis->vi, &vorbis->vc, &packet) < 0)
|
||||||
{
|
{
|
||||||
ogg_stream_clear (&codec->os);
|
ogg_stream_clear (&codec->os);
|
||||||
@ -383,7 +383,7 @@ ogg_codec_t *initial_vorbis_page (format_plugin_t *plugin, ogg_page *page)
|
|||||||
free (codec);
|
free (codec);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
LOG_INFO("seen initial vorbis header");
|
ICECAST_LOG_INFO("seen initial vorbis header");
|
||||||
codec->specific = vorbis;
|
codec->specific = vorbis;
|
||||||
codec->codec_free = vorbis_codec_free;
|
codec->codec_free = vorbis_codec_free;
|
||||||
codec->headers = 1;
|
codec->headers = 1;
|
||||||
@ -523,7 +523,7 @@ static refbuf_t *process_vorbis_page (ogg_state_t *ogg_info,
|
|||||||
while (codec->headers < 3)
|
while (codec->headers < 3)
|
||||||
{
|
{
|
||||||
/* now, lets extract the packets */
|
/* now, lets extract the packets */
|
||||||
LOG_DEBUG("processing incoming header packet (%d)", codec->headers);
|
ICECAST_LOG_DEBUG("processing incoming header packet (%d)", codec->headers);
|
||||||
|
|
||||||
if (ogg_stream_packetout (&codec->os, &header) <= 0)
|
if (ogg_stream_packetout (&codec->os, &header) <= 0)
|
||||||
{
|
{
|
||||||
@ -536,14 +536,14 @@ static refbuf_t *process_vorbis_page (ogg_state_t *ogg_info,
|
|||||||
if (vorbis_synthesis_headerin (&source_vorbis->vi, &source_vorbis->vc, &header) < 0)
|
if (vorbis_synthesis_headerin (&source_vorbis->vi, &source_vorbis->vc, &header) < 0)
|
||||||
{
|
{
|
||||||
ogg_info->error = 1;
|
ogg_info->error = 1;
|
||||||
LOG_WARN("Problem parsing ogg vorbis header");
|
ICECAST_LOG_WARN("Problem parsing ogg vorbis header");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
header.granulepos = 0;
|
header.granulepos = 0;
|
||||||
source_vorbis->header [codec->headers] = copy_ogg_packet (&header);
|
source_vorbis->header [codec->headers] = copy_ogg_packet (&header);
|
||||||
codec->headers++;
|
codec->headers++;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("we have the header packets now");
|
ICECAST_LOG_DEBUG("we have the header packets now");
|
||||||
|
|
||||||
/* if vorbis is the only codec then allow rebuilding of the streams */
|
/* if vorbis is the only codec then allow rebuilding of the streams */
|
||||||
if (ogg_info->codecs->next == NULL)
|
if (ogg_info->codecs->next == NULL)
|
||||||
|
24
src/fserve.c
24
src/fserve.c
@ -108,7 +108,7 @@ void fserve_initialize(void)
|
|||||||
config_release_config();
|
config_release_config();
|
||||||
|
|
||||||
stats_event (NULL, "file_connections", "0");
|
stats_event (NULL, "file_connections", "0");
|
||||||
LOG_INFO("file serving started");
|
ICECAST_LOG_INFO("file serving started");
|
||||||
}
|
}
|
||||||
|
|
||||||
void fserve_shutdown(void)
|
void fserve_shutdown(void)
|
||||||
@ -134,7 +134,7 @@ void fserve_shutdown(void)
|
|||||||
|
|
||||||
thread_spin_unlock (&pending_lock);
|
thread_spin_unlock (&pending_lock);
|
||||||
thread_spin_destroy (&pending_lock);
|
thread_spin_destroy (&pending_lock);
|
||||||
LOG_INFO("file serving stopped");
|
ICECAST_LOG_INFO("file serving stopped");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_POLL
|
#ifdef HAVE_POLL
|
||||||
@ -332,7 +332,7 @@ static void *fserv_thread_function(void *arg)
|
|||||||
fclient = fclient->next;
|
fclient = fclient->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_DEBUG("fserve handler exit");
|
ICECAST_LOG_DEBUG("fserve handler exit");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
|||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
||||||
fullpath = util_get_path_from_normalised_uri (path);
|
fullpath = util_get_path_from_normalised_uri (path);
|
||||||
LOG_INFO("checking for file %H (%H)", path, fullpath);
|
ICECAST_LOG_INFO("checking for file %H (%H)", path, fullpath);
|
||||||
|
|
||||||
if (strcmp (util_get_extension (fullpath), "m3u") == 0)
|
if (strcmp (util_get_extension (fullpath), "m3u") == 0)
|
||||||
m3u_requested = 1;
|
m3u_requested = 1;
|
||||||
@ -431,7 +431,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
|||||||
/* the m3u can be generated, but send an m3u file if available */
|
/* the m3u can be generated, but send an m3u file if available */
|
||||||
if (m3u_requested == 0 && xslt_playlist_requested == NULL)
|
if (m3u_requested == 0 && xslt_playlist_requested == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("req for file \"%H\" %s", fullpath, strerror (errno));
|
ICECAST_LOG_WARN("req for file \"%H\" %s", fullpath, strerror (errno));
|
||||||
client_send_404 (httpclient, "The file you requested could not be found");
|
client_send_404 (httpclient, "The file you requested could not be found");
|
||||||
free (fullpath);
|
free (fullpath);
|
||||||
return -1;
|
return -1;
|
||||||
@ -501,7 +501,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
|||||||
config = config_get_config();
|
config = config_get_config();
|
||||||
if (config->fileserve == 0)
|
if (config->fileserve == 0)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("on demand file \"%H\" refused", fullpath);
|
ICECAST_LOG_DEBUG("on demand file \"%H\" refused", fullpath);
|
||||||
client_send_404 (httpclient, "The file you requested could not be found");
|
client_send_404 (httpclient, "The file you requested could not be found");
|
||||||
config_release_config();
|
config_release_config();
|
||||||
free (fullpath);
|
free (fullpath);
|
||||||
@ -512,7 +512,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
|||||||
if (S_ISREG (file_buf.st_mode) == 0)
|
if (S_ISREG (file_buf.st_mode) == 0)
|
||||||
{
|
{
|
||||||
client_send_404 (httpclient, "The file you requested could not be found");
|
client_send_404 (httpclient, "The file you requested could not be found");
|
||||||
LOG_WARN("found requested file but there is no handler for it: %H", fullpath);
|
ICECAST_LOG_WARN("found requested file but there is no handler for it: %H", fullpath);
|
||||||
free (fullpath);
|
free (fullpath);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
|||||||
file = fopen (fullpath, "rb");
|
file = fopen (fullpath, "rb");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("Problem accessing file \"%H\"", fullpath);
|
ICECAST_LOG_WARN("Problem accessing file \"%H\"", fullpath);
|
||||||
client_send_404 (httpclient, "File not readable");
|
client_send_404 (httpclient, "File not readable");
|
||||||
free (fullpath);
|
free (fullpath);
|
||||||
return -1;
|
return -1;
|
||||||
@ -629,7 +629,7 @@ static void fserve_add_pending (fserve_t *fclient)
|
|||||||
if (run_fserv == 0)
|
if (run_fserv == 0)
|
||||||
{
|
{
|
||||||
run_fserv = 1;
|
run_fserv = 1;
|
||||||
LOG_DEBUG("fserve handler waking up");
|
ICECAST_LOG_DEBUG("fserve handler waking up");
|
||||||
thread_create("File Serving Thread", fserv_thread_function, NULL, THREAD_DETACHED);
|
thread_create("File Serving Thread", fserv_thread_function, NULL, THREAD_DETACHED);
|
||||||
}
|
}
|
||||||
thread_spin_unlock (&pending_lock);
|
thread_spin_unlock (&pending_lock);
|
||||||
@ -643,7 +643,7 @@ int fserve_add_client (client_t *client, FILE *file)
|
|||||||
{
|
{
|
||||||
fserve_t *fclient = calloc (1, sizeof(fserve_t));
|
fserve_t *fclient = calloc (1, sizeof(fserve_t));
|
||||||
|
|
||||||
LOG_DEBUG("Adding client to file serving engine");
|
ICECAST_LOG_DEBUG("Adding client to file serving engine");
|
||||||
if (fclient == NULL)
|
if (fclient == NULL)
|
||||||
{
|
{
|
||||||
client_send_404 (client, "memory exhausted");
|
client_send_404 (client, "memory exhausted");
|
||||||
@ -665,7 +665,7 @@ void fserve_add_client_callback (client_t *client, fserve_callback_t callback, v
|
|||||||
{
|
{
|
||||||
fserve_t *fclient = calloc (1, sizeof(fserve_t));
|
fserve_t *fclient = calloc (1, sizeof(fserve_t));
|
||||||
|
|
||||||
LOG_DEBUG("Adding client to file serving engine");
|
ICECAST_LOG_DEBUG("Adding client to file serving engine");
|
||||||
if (fclient == NULL)
|
if (fclient == NULL)
|
||||||
{
|
{
|
||||||
client_send_404 (client, "memory exhausted");
|
client_send_404 (client, "memory exhausted");
|
||||||
@ -710,7 +710,7 @@ void fserve_recheck_mime_types (ice_config_t *config)
|
|||||||
mimefile = fopen (config->mimetypes_fn, "r");
|
mimefile = fopen (config->mimetypes_fn, "r");
|
||||||
if (mimefile == NULL)
|
if (mimefile == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("Cannot open mime types file %s", config->mimetypes_fn);
|
ICECAST_LOG_WARN("Cannot open mime types file %s", config->mimetypes_fn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,10 +31,10 @@ extern int playlistlog;
|
|||||||
** Variadic macros for logging
|
** Variadic macros for logging
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LOG_ERROR(...) log_write(errorlog, 1, CATMODULE "/", __func__, __VA_ARGS__)
|
#define ICECAST_LOG_ERROR(...) log_write(errorlog, 1, CATMODULE "/", __func__, __VA_ARGS__)
|
||||||
#define LOG_WARN(...) log_write(errorlog, 2, CATMODULE "/", __func__, __VA_ARGS__)
|
#define ICECAST_LOG_WARN(...) log_write(errorlog, 2, CATMODULE "/", __func__, __VA_ARGS__)
|
||||||
#define LOG_INFO(...) log_write(errorlog, 3, CATMODULE "/", __func__, __VA_ARGS__)
|
#define ICECAST_LOG_INFO(...) log_write(errorlog, 3, CATMODULE "/", __func__, __VA_ARGS__)
|
||||||
#define LOG_DEBUG(...) log_write(errorlog, 4, CATMODULE "/", __func__, __VA_ARGS__)
|
#define ICECAST_LOG_DEBUG(...) log_write(errorlog, 4, CATMODULE "/", __func__, __VA_ARGS__)
|
||||||
|
|
||||||
/* CATMODULE is the category or module that logging messages come from.
|
/* CATMODULE is the category or module that logging messages come from.
|
||||||
** we set one here in cause someone forgets in the .c file.
|
** we set one here in cause someone forgets in the .c file.
|
||||||
|
@ -506,7 +506,7 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("%s server started", ICECAST_VERSION_STRING);
|
ICECAST_LOG_INFO("%s server started", ICECAST_VERSION_STRING);
|
||||||
|
|
||||||
/* REM 3D Graphics */
|
/* REM 3D Graphics */
|
||||||
|
|
||||||
@ -522,7 +522,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
_server_proc();
|
_server_proc();
|
||||||
|
|
||||||
LOG_INFO("Shutting down");
|
ICECAST_LOG_INFO("Shutting down");
|
||||||
#if !defined(_WIN32) || defined(_CONSOLE) || defined(__MINGW32__) || defined(__MINGW64__)
|
#if !defined(_WIN32) || defined(_CONSOLE) || defined(__MINGW32__) || defined(__MINGW64__)
|
||||||
shutdown_subsystems();
|
shutdown_subsystems();
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,7 +89,7 @@ void refbuf_release(refbuf_t *self)
|
|||||||
{
|
{
|
||||||
refbuf_release_associated (self->associated);
|
refbuf_release_associated (self->associated);
|
||||||
if (self->next)
|
if (self->next)
|
||||||
LOG_ERROR("next not null");
|
ICECAST_LOG_ERROR("next not null");
|
||||||
free(self->data);
|
free(self->data);
|
||||||
free(self);
|
free(self);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ void _sig_ignore(int signo)
|
|||||||
|
|
||||||
void _sig_hup(int signo)
|
void _sig_hup(int signo)
|
||||||
{
|
{
|
||||||
LOG_INFO("Caught signal %d, scheduling config re-read...", signo);
|
ICECAST_LOG_INFO("Caught signal %d, scheduling config re-read...", signo);
|
||||||
|
|
||||||
global_lock();
|
global_lock();
|
||||||
global . schedule_config_reread = 1;
|
global . schedule_config_reread = 1;
|
||||||
@ -67,7 +67,7 @@ void _sig_hup(int signo)
|
|||||||
|
|
||||||
void _sig_die(int signo)
|
void _sig_die(int signo)
|
||||||
{
|
{
|
||||||
LOG_INFO("Caught signal %d, shutting down...", signo);
|
ICECAST_LOG_INFO("Caught signal %d, shutting down...", signo);
|
||||||
|
|
||||||
/* inform the server to start shutting down */
|
/* inform the server to start shutting down */
|
||||||
global.running = ICE_HALTING;
|
global.running = ICE_HALTING;
|
||||||
|
50
src/slave.c
50
src/slave.c
@ -70,7 +70,7 @@ static mutex_t _slave_mutex; // protects update_settings, update_all_mounts, max
|
|||||||
relay_server *relay_free (relay_server *relay)
|
relay_server *relay_free (relay_server *relay)
|
||||||
{
|
{
|
||||||
relay_server *next = relay->next;
|
relay_server *next = relay->next;
|
||||||
LOG_DEBUG("freeing relay %s", relay->localmount);
|
ICECAST_LOG_DEBUG("freeing relay %s", relay->localmount);
|
||||||
if (relay->source)
|
if (relay->source)
|
||||||
source_free_source (relay->source);
|
source_free_source (relay->source);
|
||||||
xmlFree (relay->server);
|
xmlFree (relay->server);
|
||||||
@ -147,7 +147,7 @@ void slave_shutdown(void)
|
|||||||
if (!slave_running)
|
if (!slave_running)
|
||||||
return;
|
return;
|
||||||
slave_running = 0;
|
slave_running = 0;
|
||||||
LOG_DEBUG("waiting for slave thread");
|
ICECAST_LOG_DEBUG("waiting for slave thread");
|
||||||
thread_join (_slave_thread_id);
|
thread_join (_slave_thread_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,12 +195,12 @@ static client_t *open_relay_connection (relay_server *relay)
|
|||||||
{
|
{
|
||||||
sock_t streamsock;
|
sock_t streamsock;
|
||||||
|
|
||||||
LOG_INFO("connecting to %s:%d", server, port);
|
ICECAST_LOG_INFO("connecting to %s:%d", server, port);
|
||||||
|
|
||||||
streamsock = sock_connect_wto_bind (server, port, relay->bind, 10);
|
streamsock = sock_connect_wto_bind (server, port, relay->bind, 10);
|
||||||
if (streamsock == SOCK_ERROR)
|
if (streamsock == SOCK_ERROR)
|
||||||
{
|
{
|
||||||
LOG_WARN("Failed to connect to %s:%d", server, port);
|
ICECAST_LOG_WARN("Failed to connect to %s:%d", server, port);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
con = connection_create (streamsock, -1, strdup (server));
|
con = connection_create (streamsock, -1, strdup (server));
|
||||||
@ -224,14 +224,14 @@ static client_t *open_relay_connection (relay_server *relay)
|
|||||||
memset (header, 0, sizeof(header));
|
memset (header, 0, sizeof(header));
|
||||||
if (util_read_header (con->sock, header, 4096, READ_ENTIRE_HEADER) == 0)
|
if (util_read_header (con->sock, header, 4096, READ_ENTIRE_HEADER) == 0)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Header read failed for %s (%s:%d%s)", relay->localmount, server, port, mount);
|
ICECAST_LOG_ERROR("Header read failed for %s (%s:%d%s)", relay->localmount, server, port, mount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parser = httpp_create_parser();
|
parser = httpp_create_parser();
|
||||||
httpp_initialize (parser, NULL);
|
httpp_initialize (parser, NULL);
|
||||||
if (! httpp_parse_response (parser, header, strlen(header), relay->localmount))
|
if (! httpp_parse_response (parser, header, strlen(header), relay->localmount))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Error parsing relay request for %s (%s:%d%s)", relay->localmount,
|
ICECAST_LOG_ERROR("Error parsing relay request for %s (%s:%d%s)", relay->localmount,
|
||||||
server, port, mount);
|
server, port, mount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ static client_t *open_relay_connection (relay_server *relay)
|
|||||||
int len;
|
int len;
|
||||||
|
|
||||||
uri = httpp_getvar (parser, "location");
|
uri = httpp_getvar (parser, "location");
|
||||||
LOG_INFO("redirect received %s", uri);
|
ICECAST_LOG_INFO("redirect received %s", uri);
|
||||||
if (strncmp (uri, "http://", 7) != 0)
|
if (strncmp (uri, "http://", 7) != 0)
|
||||||
break;
|
break;
|
||||||
uri += 7;
|
uri += 7;
|
||||||
@ -271,7 +271,7 @@ static client_t *open_relay_connection (relay_server *relay)
|
|||||||
|
|
||||||
if (httpp_getvar (parser, HTTPP_VAR_ERROR_MESSAGE))
|
if (httpp_getvar (parser, HTTPP_VAR_ERROR_MESSAGE))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Error from relay request: %s (%s)", relay->localmount,
|
ICECAST_LOG_ERROR("Error from relay request: %s (%s)", relay->localmount,
|
||||||
httpp_getvar(parser, HTTPP_VAR_ERROR_MESSAGE));
|
httpp_getvar(parser, HTTPP_VAR_ERROR_MESSAGE));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -319,7 +319,7 @@ static void *start_relay_stream (void *arg)
|
|||||||
source_t *src = relay->source;
|
source_t *src = relay->source;
|
||||||
client_t *client;
|
client_t *client;
|
||||||
|
|
||||||
LOG_INFO("Starting relayed source at mountpoint \"%s\"", relay->localmount);
|
ICECAST_LOG_INFO("Starting relayed source at mountpoint \"%s\"", relay->localmount);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
client = open_relay_connection (relay);
|
client = open_relay_connection (relay);
|
||||||
@ -333,7 +333,7 @@ static void *start_relay_stream (void *arg)
|
|||||||
|
|
||||||
if (connection_complete_source (src, 0) < 0)
|
if (connection_complete_source (src, 0) < 0)
|
||||||
{
|
{
|
||||||
LOG_INFO("Failed to complete source initialisation");
|
ICECAST_LOG_INFO("Failed to complete source initialisation");
|
||||||
client_destroy (client);
|
client_destroy (client);
|
||||||
src->client = NULL;
|
src->client = NULL;
|
||||||
continue;
|
continue;
|
||||||
@ -363,7 +363,7 @@ static void *start_relay_stream (void *arg)
|
|||||||
{
|
{
|
||||||
source_t *fallback_source;
|
source_t *fallback_source;
|
||||||
|
|
||||||
LOG_DEBUG("failed relay, fallback to %s", relay->source->fallback_mount);
|
ICECAST_LOG_DEBUG("failed relay, fallback to %s", relay->source->fallback_mount);
|
||||||
avl_tree_rlock(global.source_tree);
|
avl_tree_rlock(global.source_tree);
|
||||||
fallback_source = source_find_mount (relay->source->fallback_mount);
|
fallback_source = source_find_mount (relay->source->fallback_mount);
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ static void check_relay_stream (relay_server *relay)
|
|||||||
{
|
{
|
||||||
if (relay->localmount[0] != '/')
|
if (relay->localmount[0] != '/')
|
||||||
{
|
{
|
||||||
LOG_WARN("relay mountpoint \"%s\" does not start with /, skipping",
|
ICECAST_LOG_WARN("relay mountpoint \"%s\" does not start with /, skipping",
|
||||||
relay->localmount);
|
relay->localmount);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -403,7 +403,7 @@ static void check_relay_stream (relay_server *relay)
|
|||||||
relay->source = source_reserve (relay->localmount);
|
relay->source = source_reserve (relay->localmount);
|
||||||
if (relay->source)
|
if (relay->source)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Adding relay source at mountpoint \"%s\"", relay->localmount);
|
ICECAST_LOG_DEBUG("Adding relay source at mountpoint \"%s\"", relay->localmount);
|
||||||
if (relay->on_demand)
|
if (relay->on_demand)
|
||||||
{
|
{
|
||||||
ice_config_t *config = config_get_config ();
|
ice_config_t *config = config_get_config ();
|
||||||
@ -419,7 +419,7 @@ static void check_relay_stream (relay_server *relay)
|
|||||||
{
|
{
|
||||||
if (relay->start == 0)
|
if (relay->start == 0)
|
||||||
{
|
{
|
||||||
LOG_WARN("new relay but source \"%s\" already exists", relay->localmount);
|
ICECAST_LOG_WARN("new relay but source \"%s\" already exists", relay->localmount);
|
||||||
relay->start = 1;
|
relay->start = 1;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -443,7 +443,7 @@ static void check_relay_stream (relay_server *relay)
|
|||||||
fallback = source_find_mount (source->fallback_mount);
|
fallback = source_find_mount (source->fallback_mount);
|
||||||
if (fallback && fallback->running && fallback->listeners)
|
if (fallback && fallback->running && fallback->listeners)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("fallback running %d with %lu listeners", fallback->running, fallback->listeners);
|
ICECAST_LOG_DEBUG("fallback running %d with %lu listeners", fallback->running, fallback->listeners);
|
||||||
source->on_demand_req = 1;
|
source->on_demand_req = 1;
|
||||||
}
|
}
|
||||||
avl_tree_unlock (global.source_tree);
|
avl_tree_unlock (global.source_tree);
|
||||||
@ -464,7 +464,7 @@ static void check_relay_stream (relay_server *relay)
|
|||||||
{
|
{
|
||||||
if (relay->thread)
|
if (relay->thread)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("waiting for relay thread for \"%s\"", relay->localmount);
|
ICECAST_LOG_DEBUG("waiting for relay thread for \"%s\"", relay->localmount);
|
||||||
thread_join (relay->thread);
|
thread_join (relay->thread);
|
||||||
relay->thread = NULL;
|
relay->thread = NULL;
|
||||||
}
|
}
|
||||||
@ -579,7 +579,7 @@ static void relay_check_streams (relay_server *to_start,
|
|||||||
if (to_free->running)
|
if (to_free->running)
|
||||||
{
|
{
|
||||||
/* relay has been removed from xml, shut down active relay */
|
/* relay has been removed from xml, shut down active relay */
|
||||||
LOG_DEBUG("source shutdown request on \"%s\"", to_free->localmount);
|
ICECAST_LOG_DEBUG("source shutdown request on \"%s\"", to_free->localmount);
|
||||||
to_free->running = 0;
|
to_free->running = 0;
|
||||||
to_free->source->running = 0;
|
to_free->source->running = 0;
|
||||||
thread_join (to_free->thread);
|
thread_join (to_free->thread);
|
||||||
@ -633,7 +633,7 @@ static int update_from_master(ice_config_t *config)
|
|||||||
|
|
||||||
if (mastersock == SOCK_ERROR)
|
if (mastersock == SOCK_ERROR)
|
||||||
{
|
{
|
||||||
LOG_WARN("Relay slave failed to contact master server to fetch stream list");
|
ICECAST_LOG_WARN("Relay slave failed to contact master server to fetch stream list");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -652,7 +652,7 @@ static int update_from_master(ice_config_t *config)
|
|||||||
strncmp (buf, "HTTP/1.0 200", 12) != 0)
|
strncmp (buf, "HTTP/1.0 200", 12) != 0)
|
||||||
{
|
{
|
||||||
sock_close (mastersock);
|
sock_close (mastersock);
|
||||||
LOG_WARN("Master rejected streamlist request");
|
ICECAST_LOG_WARN("Master rejected streamlist request");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -666,10 +666,10 @@ static int update_from_master(ice_config_t *config)
|
|||||||
relay_server *r;
|
relay_server *r;
|
||||||
if (!strlen(buf))
|
if (!strlen(buf))
|
||||||
continue;
|
continue;
|
||||||
LOG_DEBUG("read %d from master \"%s\"", count++, buf);
|
ICECAST_LOG_DEBUG("read %d from master \"%s\"", count++, buf);
|
||||||
xmlURIPtr parsed_uri = xmlParseURI(buf);
|
xmlURIPtr parsed_uri = xmlParseURI(buf);
|
||||||
if (parsed_uri == NULL) {
|
if (parsed_uri == NULL) {
|
||||||
LOG_DEBUG("Error while parsing line from master. Ignoring line.");
|
ICECAST_LOG_DEBUG("Error while parsing line from master. Ignoring line.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
r = calloc (1, sizeof (relay_server));
|
r = calloc (1, sizeof (relay_server));
|
||||||
@ -694,7 +694,7 @@ static int update_from_master(ice_config_t *config)
|
|||||||
r->mp3metadata = 1;
|
r->mp3metadata = 1;
|
||||||
r->on_demand = on_demand;
|
r->on_demand = on_demand;
|
||||||
r->next = new_relays;
|
r->next = new_relays;
|
||||||
LOG_DEBUG("Added relay host=\"%s\", port=%d, mount=\"%s\"", r->server, r->port, r->mount);
|
ICECAST_LOG_DEBUG("Added relay host=\"%s\", port=%d, mount=\"%s\"", r->server, r->port, r->mount);
|
||||||
new_relays = r;
|
new_relays = r;
|
||||||
}
|
}
|
||||||
xmlFreeURI(parsed_uri);
|
xmlFreeURI(parsed_uri);
|
||||||
@ -761,7 +761,7 @@ static void *_slave_thread(void *arg)
|
|||||||
thread_mutex_lock(&_slave_mutex);
|
thread_mutex_lock(&_slave_mutex);
|
||||||
if (max_interval <= interval)
|
if (max_interval <= interval)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("checking master stream list");
|
ICECAST_LOG_DEBUG("checking master stream list");
|
||||||
config = config_get_config();
|
config = config_get_config();
|
||||||
|
|
||||||
if (max_interval == 0)
|
if (max_interval == 0)
|
||||||
@ -799,11 +799,11 @@ static void *_slave_thread(void *arg)
|
|||||||
}
|
}
|
||||||
thread_mutex_unlock(&_slave_mutex);
|
thread_mutex_unlock(&_slave_mutex);
|
||||||
}
|
}
|
||||||
LOG_INFO("shutting down current relays");
|
ICECAST_LOG_INFO("shutting down current relays");
|
||||||
relay_check_streams (NULL, global.relays, 0);
|
relay_check_streams (NULL, global.relays, 0);
|
||||||
relay_check_streams (NULL, global.master_relays, 0);
|
relay_check_streams (NULL, global.master_relays, 0);
|
||||||
|
|
||||||
LOG_INFO("Slave thread shutdown complete");
|
ICECAST_LOG_INFO("Slave thread shutdown complete");
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
96
src/source.c
96
src/source.c
@ -66,7 +66,7 @@ static int _free_client(void *key);
|
|||||||
static void _parse_audio_info (source_t *source, const char *s);
|
static void _parse_audio_info (source_t *source, const char *s);
|
||||||
static void source_shutdown (source_t *source);
|
static void source_shutdown (source_t *source);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define source_run_script(x,y) LOG_WARN("on [dis]connect scripts disabled");
|
#define source_run_script(x,y) ICECAST_LOG_WARN("on [dis]connect scripts disabled");
|
||||||
#else
|
#else
|
||||||
static void source_run_script (char *command, char *mountpoint);
|
static void source_run_script (char *command, char *mountpoint);
|
||||||
#endif
|
#endif
|
||||||
@ -80,7 +80,7 @@ source_t *source_reserve (const char *mount)
|
|||||||
source_t *src = NULL;
|
source_t *src = NULL;
|
||||||
|
|
||||||
if(mount[0] != '/')
|
if(mount[0] != '/')
|
||||||
LOG_WARN("Source at \"%s\" does not start with '/', clients will be "
|
ICECAST_LOG_WARN("Source at \"%s\" does not start with '/', clients will be "
|
||||||
"unable to connect", mount);
|
"unable to connect", mount);
|
||||||
|
|
||||||
do
|
do
|
||||||
@ -197,7 +197,7 @@ void source_clear_source (source_t *source)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
LOG_DEBUG("clearing source \"%s\"", source->mount);
|
ICECAST_LOG_DEBUG("clearing source \"%s\"", source->mount);
|
||||||
|
|
||||||
avl_tree_wlock (source->pending_tree);
|
avl_tree_wlock (source->pending_tree);
|
||||||
client_destroy(source->client);
|
client_destroy(source->client);
|
||||||
@ -211,7 +211,7 @@ void source_clear_source (source_t *source)
|
|||||||
|
|
||||||
if (source->dumpfile)
|
if (source->dumpfile)
|
||||||
{
|
{
|
||||||
LOG_INFO("Closing dumpfile for %s", source->mount);
|
ICECAST_LOG_INFO("Closing dumpfile for %s", source->mount);
|
||||||
fclose (source->dumpfile);
|
fclose (source->dumpfile);
|
||||||
source->dumpfile = NULL;
|
source->dumpfile = NULL;
|
||||||
}
|
}
|
||||||
@ -235,7 +235,7 @@ void source_clear_source (source_t *source)
|
|||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
stats_event_sub (NULL, "listeners", source->listeners);
|
stats_event_sub (NULL, "listeners", source->listeners);
|
||||||
LOG_INFO("%d active listeners on %s released", c, source->mount);
|
ICECAST_LOG_INFO("%d active listeners on %s released", c, source->mount);
|
||||||
}
|
}
|
||||||
avl_tree_unlock (source->client_tree);
|
avl_tree_unlock (source->client_tree);
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ void source_clear_source (source_t *source)
|
|||||||
/* Remove the provided source from the global tree and free it */
|
/* Remove the provided source from the global tree and free it */
|
||||||
void source_free_source (source_t *source)
|
void source_free_source (source_t *source)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("freeing source \"%s\"", source->mount);
|
ICECAST_LOG_DEBUG("freeing source \"%s\"", source->mount);
|
||||||
avl_tree_wlock (global.source_tree);
|
avl_tree_wlock (global.source_tree);
|
||||||
avl_delete (global.source_tree, source, NULL);
|
avl_delete (global.source_tree, source, NULL);
|
||||||
avl_tree_unlock (global.source_tree);
|
avl_tree_unlock (global.source_tree);
|
||||||
@ -345,7 +345,7 @@ void source_move_clients (source_t *source, source_t *dest)
|
|||||||
unsigned long count = 0;
|
unsigned long count = 0;
|
||||||
if (strcmp (source->mount, dest->mount) == 0)
|
if (strcmp (source->mount, dest->mount) == 0)
|
||||||
{
|
{
|
||||||
LOG_WARN("src and dst are the same \"%s\", skipping", source->mount);
|
ICECAST_LOG_WARN("src and dst are the same \"%s\", skipping", source->mount);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* we don't want the two write locks to deadlock in here */
|
/* we don't want the two write locks to deadlock in here */
|
||||||
@ -356,7 +356,7 @@ void source_move_clients (source_t *source, source_t *dest)
|
|||||||
avl_tree_wlock (dest->pending_tree);
|
avl_tree_wlock (dest->pending_tree);
|
||||||
if (dest->running == 0 && dest->on_demand == 0)
|
if (dest->running == 0 && dest->on_demand == 0)
|
||||||
{
|
{
|
||||||
LOG_WARN("destination mount %s not running, unable to move clients ", dest->mount);
|
ICECAST_LOG_WARN("destination mount %s not running, unable to move clients ", dest->mount);
|
||||||
avl_tree_unlock (dest->pending_tree);
|
avl_tree_unlock (dest->pending_tree);
|
||||||
thread_mutex_unlock (&move_clients_mutex);
|
thread_mutex_unlock (&move_clients_mutex);
|
||||||
return;
|
return;
|
||||||
@ -373,14 +373,14 @@ void source_move_clients (source_t *source, source_t *dest)
|
|||||||
|
|
||||||
if (source->on_demand == 0 && source->format == NULL)
|
if (source->on_demand == 0 && source->format == NULL)
|
||||||
{
|
{
|
||||||
LOG_INFO("source mount %s is not available", source->mount);
|
ICECAST_LOG_INFO("source mount %s is not available", source->mount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (source->format && dest->format)
|
if (source->format && dest->format)
|
||||||
{
|
{
|
||||||
if (source->format->type != dest->format->type)
|
if (source->format->type != dest->format->type)
|
||||||
{
|
{
|
||||||
LOG_WARN("stream %s and %s are of different types, ignored", source->mount, dest->mount);
|
ICECAST_LOG_WARN("stream %s and %s are of different types, ignored", source->mount, dest->mount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -432,7 +432,7 @@ void source_move_clients (source_t *source, source_t *dest)
|
|||||||
avl_insert (dest->pending_tree, (void *)client);
|
avl_insert (dest->pending_tree, (void *)client);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
LOG_INFO("passing %lu listeners to \"%s\"", count, dest->mount);
|
ICECAST_LOG_INFO("passing %lu listeners to \"%s\"", count, dest->mount);
|
||||||
|
|
||||||
source->listeners = 0;
|
source->listeners = 0;
|
||||||
stats_event (source->mount, "listeners", "0");
|
stats_event (source->mount, "listeners", "0");
|
||||||
@ -487,7 +487,7 @@ static refbuf_t *get_next_buffer (source_t *source)
|
|||||||
{
|
{
|
||||||
if (! sock_recoverable (sock_error()))
|
if (! sock_recoverable (sock_error()))
|
||||||
{
|
{
|
||||||
LOG_WARN("Error while waiting on socket, Disconnecting source");
|
ICECAST_LOG_WARN("Error while waiting on socket, Disconnecting source");
|
||||||
source->running = 0;
|
source->running = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -497,9 +497,9 @@ static refbuf_t *get_next_buffer (source_t *source)
|
|||||||
thread_mutex_lock(&source->lock);
|
thread_mutex_lock(&source->lock);
|
||||||
if ((source->last_read + (time_t)source->timeout) < current)
|
if ((source->last_read + (time_t)source->timeout) < current)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("last %ld, timeout %d, now %ld", (long)source->last_read,
|
ICECAST_LOG_DEBUG("last %ld, timeout %d, now %ld", (long)source->last_read,
|
||||||
source->timeout, (long)current);
|
source->timeout, (long)current);
|
||||||
LOG_WARN("Disconnecting source due to socket timeout");
|
ICECAST_LOG_WARN("Disconnecting source due to socket timeout");
|
||||||
source->running = 0;
|
source->running = 0;
|
||||||
}
|
}
|
||||||
thread_mutex_unlock(&source->lock);
|
thread_mutex_unlock(&source->lock);
|
||||||
@ -509,7 +509,7 @@ static refbuf_t *get_next_buffer (source_t *source)
|
|||||||
refbuf = source->format->get_buffer (source);
|
refbuf = source->format->get_buffer (source);
|
||||||
if (source->client->con && source->client->con->error)
|
if (source->client->con && source->client->con->error)
|
||||||
{
|
{
|
||||||
LOG_INFO("End of Stream %s", source->mount);
|
ICECAST_LOG_INFO("End of Stream %s", source->mount);
|
||||||
source->running = 0;
|
source->running = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -538,7 +538,7 @@ static void send_to_listener (source_t *source, client_t *client, int deletion_e
|
|||||||
if (client->con->discon_time)
|
if (client->con->discon_time)
|
||||||
if (time(NULL) >= client->con->discon_time)
|
if (time(NULL) >= client->con->discon_time)
|
||||||
{
|
{
|
||||||
LOG_INFO("time limit reached for client #%lu", client->con->id);
|
ICECAST_LOG_INFO("time limit reached for client #%lu", client->con->id);
|
||||||
client->con->error = 1;
|
client->con->error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -572,7 +572,7 @@ static void send_to_listener (source_t *source, client_t *client, int deletion_e
|
|||||||
* if so, check to see if this client is still referring to it */
|
* if so, check to see if this client is still referring to it */
|
||||||
if (deletion_expected && client->refbuf && client->refbuf == source->stream_data)
|
if (deletion_expected && client->refbuf && client->refbuf == source->stream_data)
|
||||||
{
|
{
|
||||||
LOG_INFO("Client %lu (%s) has fallen too far behind, removing",
|
ICECAST_LOG_INFO("Client %lu (%s) has fallen too far behind, removing",
|
||||||
client->con->id, client->con->ip);
|
client->con->id, client->con->ip);
|
||||||
stats_event_inc (source->mount, "slow_listeners");
|
stats_event_inc (source->mount, "slow_listeners");
|
||||||
client->con->error = 1;
|
client->con->error = 1;
|
||||||
@ -641,7 +641,7 @@ static void source_init (source_t *source)
|
|||||||
source->dumpfile = source_open_dumpfile (source->dumpfilename);
|
source->dumpfile = source_open_dumpfile (source->dumpfilename);
|
||||||
if (source->dumpfile == NULL)
|
if (source->dumpfile == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("Cannot open dump file \"%s\" for appending: %s, disabling.",
|
ICECAST_LOG_WARN("Cannot open dump file \"%s\" for appending: %s, disabling.",
|
||||||
source->dumpfilename, strerror(errno));
|
source->dumpfilename, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -658,7 +658,7 @@ static void source_init (source_t *source)
|
|||||||
stats_event_time (source->mount, "stream_start");
|
stats_event_time (source->mount, "stream_start");
|
||||||
stats_event_time_iso8601 (source->mount, "stream_start_iso8601");
|
stats_event_time_iso8601 (source->mount, "stream_start_iso8601");
|
||||||
|
|
||||||
LOG_DEBUG("Source creation complete");
|
ICECAST_LOG_DEBUG("Source creation complete");
|
||||||
source->last_read = time (NULL);
|
source->last_read = time (NULL);
|
||||||
source->prev_listeners = -1;
|
source->prev_listeners = -1;
|
||||||
source->running = 1;
|
source->running = 1;
|
||||||
@ -769,7 +769,7 @@ void source_main (source_t *source)
|
|||||||
stats_event_dec (NULL, "listeners");
|
stats_event_dec (NULL, "listeners");
|
||||||
avl_delete(source->client_tree, (void *)client, _free_client);
|
avl_delete(source->client_tree, (void *)client, _free_client);
|
||||||
source->listeners--;
|
source->listeners--;
|
||||||
LOG_DEBUG("Client removed");
|
ICECAST_LOG_DEBUG("Client removed");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
client_node = avl_get_next(client_node);
|
client_node = avl_get_next(client_node);
|
||||||
@ -791,7 +791,7 @@ void source_main (source_t *source)
|
|||||||
client_node = avl_get_next(client_node);
|
client_node = avl_get_next(client_node);
|
||||||
avl_delete(source->pending_tree, (void *)client, _free_client);
|
avl_delete(source->pending_tree, (void *)client, _free_client);
|
||||||
|
|
||||||
LOG_INFO("Client deleted, exceeding maximum listeners for this "
|
ICECAST_LOG_INFO("Client deleted, exceeding maximum listeners for this "
|
||||||
"mountpoint (%s).", source->mount);
|
"mountpoint (%s).", source->mount);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -800,7 +800,7 @@ void source_main (source_t *source)
|
|||||||
avl_insert(source->client_tree, client_node->key);
|
avl_insert(source->client_tree, client_node->key);
|
||||||
|
|
||||||
source->listeners++;
|
source->listeners++;
|
||||||
LOG_DEBUG("Client added for mountpoint (%s)", source->mount);
|
ICECAST_LOG_DEBUG("Client added for mountpoint (%s)", source->mount);
|
||||||
stats_event_inc(source->mount, "connections");
|
stats_event_inc(source->mount, "connections");
|
||||||
|
|
||||||
client_node = avl_get_next(client_node);
|
client_node = avl_get_next(client_node);
|
||||||
@ -820,7 +820,7 @@ void source_main (source_t *source)
|
|||||||
if (source->listeners != source->prev_listeners)
|
if (source->listeners != source->prev_listeners)
|
||||||
{
|
{
|
||||||
source->prev_listeners = source->listeners;
|
source->prev_listeners = source->listeners;
|
||||||
LOG_INFO("listener count on %s now %lu", source->mount, source->listeners);
|
ICECAST_LOG_INFO("listener count on %s now %lu", source->mount, source->listeners);
|
||||||
if (source->listeners > source->peak_listeners)
|
if (source->listeners > source->peak_listeners)
|
||||||
{
|
{
|
||||||
source->peak_listeners = source->listeners;
|
source->peak_listeners = source->listeners;
|
||||||
@ -846,7 +846,7 @@ void source_main (source_t *source)
|
|||||||
if (to_go->next == NULL || source->burst_point == to_go)
|
if (to_go->next == NULL || source->burst_point == to_go)
|
||||||
{
|
{
|
||||||
/* this should not happen */
|
/* this should not happen */
|
||||||
LOG_ERROR("queue state is unexpected");
|
ICECAST_LOG_ERROR("queue state is unexpected");
|
||||||
source->running = 0;
|
source->running = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -869,7 +869,7 @@ static void source_shutdown (source_t *source)
|
|||||||
mount_proxy *mountinfo;
|
mount_proxy *mountinfo;
|
||||||
|
|
||||||
source->running = 0;
|
source->running = 0;
|
||||||
LOG_INFO("Source from %s at \"%s\" exiting", source->con->ip, source->mount);
|
ICECAST_LOG_INFO("Source from %s at \"%s\" exiting", source->con->ip, source->mount);
|
||||||
|
|
||||||
mountinfo = config_find_mount (config_get_config(), source->mount, MOUNT_TYPE_NORMAL);
|
mountinfo = config_find_mount (config_get_config(), source->mount, MOUNT_TYPE_NORMAL);
|
||||||
if (mountinfo)
|
if (mountinfo)
|
||||||
@ -985,7 +985,7 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
|
|||||||
int val;
|
int val;
|
||||||
http_parser_t *parser = NULL;
|
http_parser_t *parser = NULL;
|
||||||
|
|
||||||
LOG_DEBUG("Applying mount information for \"%s\"", source->mount);
|
ICECAST_LOG_DEBUG("Applying mount information for \"%s\"", source->mount);
|
||||||
avl_tree_rlock (source->client_tree);
|
avl_tree_rlock (source->client_tree);
|
||||||
stats_event_args (source->mount, "listener_peak", "%lu", source->peak_listeners);
|
stats_event_args (source->mount, "listener_peak", "%lu", source->peak_listeners);
|
||||||
|
|
||||||
@ -1028,7 +1028,7 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
|
|||||||
stats_event_args (source->mount, "public", "%d", val);
|
stats_event_args (source->mount, "public", "%d", val);
|
||||||
if (source->yp_public != val)
|
if (source->yp_public != val)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("YP changed to %d", val);
|
ICECAST_LOG_DEBUG("YP changed to %d", val);
|
||||||
if (val)
|
if (val)
|
||||||
yp_add (source->mount);
|
yp_add (source->mount);
|
||||||
else
|
else
|
||||||
@ -1176,7 +1176,7 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
|
|||||||
if (f)
|
if (f)
|
||||||
source->intro_file = f;
|
source->intro_file = f;
|
||||||
else
|
else
|
||||||
LOG_WARN("Cannot open intro file \"%s\": %s", path, strerror(errno));
|
ICECAST_LOG_WARN("Cannot open intro file \"%s\": %s", path, strerror(errno));
|
||||||
free (path);
|
free (path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1222,18 +1222,18 @@ void source_update_settings (ice_config_t *config, source_t *source, mount_proxy
|
|||||||
source_apply_mount (source, mountinfo);
|
source_apply_mount (source, mountinfo);
|
||||||
|
|
||||||
if (source->fallback_mount)
|
if (source->fallback_mount)
|
||||||
LOG_DEBUG("fallback %s", source->fallback_mount);
|
ICECAST_LOG_DEBUG("fallback %s", source->fallback_mount);
|
||||||
if (mountinfo && mountinfo->intro_filename)
|
if (mountinfo && mountinfo->intro_filename)
|
||||||
LOG_DEBUG("intro file is %s", mountinfo->intro_filename);
|
ICECAST_LOG_DEBUG("intro file is %s", mountinfo->intro_filename);
|
||||||
if (source->dumpfilename)
|
if (source->dumpfilename)
|
||||||
LOG_DEBUG("Dumping stream to %s", source->dumpfilename);
|
ICECAST_LOG_DEBUG("Dumping stream to %s", source->dumpfilename);
|
||||||
if (mountinfo && mountinfo->on_connect)
|
if (mountinfo && mountinfo->on_connect)
|
||||||
LOG_DEBUG("connect script \"%s\"", mountinfo->on_connect);
|
ICECAST_LOG_DEBUG("connect script \"%s\"", mountinfo->on_connect);
|
||||||
if (mountinfo && mountinfo->on_disconnect)
|
if (mountinfo && mountinfo->on_disconnect)
|
||||||
LOG_DEBUG("disconnect script \"%s\"", mountinfo->on_disconnect);
|
ICECAST_LOG_DEBUG("disconnect script \"%s\"", mountinfo->on_disconnect);
|
||||||
if (source->on_demand)
|
if (source->on_demand)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("on_demand set");
|
ICECAST_LOG_DEBUG("on_demand set");
|
||||||
stats_event (source->mount, "on_demand", "1");
|
stats_event (source->mount, "on_demand", "1");
|
||||||
stats_event_args (source->mount, "listeners", "%ld", source->listeners);
|
stats_event_args (source->mount, "listeners", "%ld", source->listeners);
|
||||||
}
|
}
|
||||||
@ -1243,7 +1243,7 @@ void source_update_settings (ice_config_t *config, source_t *source, mount_proxy
|
|||||||
if (source->hidden)
|
if (source->hidden)
|
||||||
{
|
{
|
||||||
stats_event_hidden (source->mount, NULL, 1);
|
stats_event_hidden (source->mount, NULL, 1);
|
||||||
LOG_DEBUG("hidden from public");
|
ICECAST_LOG_DEBUG("hidden from public");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
stats_event_hidden (source->mount, NULL, 0);
|
stats_event_hidden (source->mount, NULL, 0);
|
||||||
@ -1256,12 +1256,12 @@ void source_update_settings (ice_config_t *config, source_t *source, mount_proxy
|
|||||||
snprintf (buf, sizeof (buf), "%ld", source->max_listeners);
|
snprintf (buf, sizeof (buf), "%ld", source->max_listeners);
|
||||||
stats_event (source->mount, "max_listeners", buf);
|
stats_event (source->mount, "max_listeners", buf);
|
||||||
}
|
}
|
||||||
LOG_DEBUG("public set to %d", source->yp_public);
|
ICECAST_LOG_DEBUG("public set to %d", source->yp_public);
|
||||||
LOG_DEBUG("max listeners to %ld", source->max_listeners);
|
ICECAST_LOG_DEBUG("max listeners to %ld", source->max_listeners);
|
||||||
LOG_DEBUG("queue size to %u", source->queue_size_limit);
|
ICECAST_LOG_DEBUG("queue size to %u", source->queue_size_limit);
|
||||||
LOG_DEBUG("burst size to %u", source->burst_size);
|
ICECAST_LOG_DEBUG("burst size to %u", source->burst_size);
|
||||||
LOG_DEBUG("source timeout to %u", source->timeout);
|
ICECAST_LOG_DEBUG("source timeout to %u", source->timeout);
|
||||||
LOG_DEBUG("fallback_when_full to %u", source->fallback_when_full);
|
ICECAST_LOG_DEBUG("fallback_when_full to %u", source->fallback_when_full);
|
||||||
thread_mutex_unlock(&source->lock);
|
thread_mutex_unlock(&source->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1323,19 +1323,19 @@ static void source_run_script (char *command, char *mountpoint)
|
|||||||
switch (pid = fork ())
|
switch (pid = fork ())
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
LOG_ERROR("Unable to fork %s (%s)", command, strerror (errno));
|
ICECAST_LOG_ERROR("Unable to fork %s (%s)", command, strerror (errno));
|
||||||
break;
|
break;
|
||||||
case 0: /* child */
|
case 0: /* child */
|
||||||
LOG_DEBUG("Starting command %s", command);
|
ICECAST_LOG_DEBUG("Starting command %s", command);
|
||||||
execl (command, command, mountpoint, (char *)NULL);
|
execl (command, command, mountpoint, (char *)NULL);
|
||||||
LOG_ERROR("Unable to run command %s (%s)", command, strerror (errno));
|
ICECAST_LOG_ERROR("Unable to run command %s (%s)", command, strerror (errno));
|
||||||
exit(0);
|
exit(0);
|
||||||
default: /* parent */
|
default: /* parent */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
exit (0);
|
exit (0);
|
||||||
case -1:
|
case -1:
|
||||||
LOG_ERROR("Unable to fork %s", strerror (errno));
|
ICECAST_LOG_ERROR("Unable to fork %s", strerror (errno));
|
||||||
break;
|
break;
|
||||||
default: /* parent */
|
default: /* parent */
|
||||||
waitpid (external_pid, NULL, 0);
|
waitpid (external_pid, NULL, 0);
|
||||||
@ -1373,7 +1373,7 @@ static void *source_fallback_file (void *arg)
|
|||||||
file = fopen (path, "rb");
|
file = fopen (path, "rb");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("unable to open file \"%s\"", path);
|
ICECAST_LOG_WARN("unable to open file \"%s\"", path);
|
||||||
free (path);
|
free (path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1381,10 +1381,10 @@ static void *source_fallback_file (void *arg)
|
|||||||
source = source_reserve (mount);
|
source = source_reserve (mount);
|
||||||
if (source == NULL)
|
if (source == NULL)
|
||||||
{
|
{
|
||||||
LOG_WARN("mountpoint \"%s\" already reserved", mount);
|
ICECAST_LOG_WARN("mountpoint \"%s\" already reserved", mount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LOG_INFO("mountpoint %s is reserved", mount);
|
ICECAST_LOG_INFO("mountpoint %s is reserved", mount);
|
||||||
type = fserve_content_type (mount);
|
type = fserve_content_type (mount);
|
||||||
parser = httpp_create_parser();
|
parser = httpp_create_parser();
|
||||||
httpp_initialize (parser, NULL);
|
httpp_initialize (parser, NULL);
|
||||||
|
38
src/stats.c
38
src/stats.c
@ -160,7 +160,7 @@ void stats_shutdown(void)
|
|||||||
n = _stats_threads;
|
n = _stats_threads;
|
||||||
thread_mutex_unlock(&_stats_mutex);
|
thread_mutex_unlock(&_stats_mutex);
|
||||||
} while (n > 0);
|
} while (n > 0);
|
||||||
LOG_INFO("stats thread finished");
|
ICECAST_LOG_INFO("stats thread finished");
|
||||||
|
|
||||||
/* free the queues */
|
/* free the queues */
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ void stats_event(const char *source, const char *name, const char *value)
|
|||||||
|
|
||||||
if (value && xmlCheckUTF8 ((unsigned char *)value) == 0)
|
if (value && xmlCheckUTF8 ((unsigned char *)value) == 0)
|
||||||
{
|
{
|
||||||
LOG_WARN("seen non-UTF8 data, probably incorrect metadata (%s, %s)", name, value);
|
ICECAST_LOG_WARN("seen non-UTF8 data, probably incorrect metadata (%s, %s)", name, value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event = build_event (source, name, value);
|
event = build_event (source, name, value);
|
||||||
@ -234,7 +234,7 @@ void stats_event_conv(const char *mount, const char *name, const char *value, co
|
|||||||
xmlCharEncCloseFunc (handle);
|
xmlCharEncCloseFunc (handle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LOG_WARN("No charset found for \"%s\"", charset);
|
ICECAST_LOG_WARN("No charset found for \"%s\"", charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
stats_event (mount, name, metadata);
|
stats_event (mount, name, metadata);
|
||||||
@ -273,7 +273,7 @@ void stats_event_args(const char *source, char *name, char *format, ...)
|
|||||||
|
|
||||||
if (ret < 0 || (unsigned int)ret >= sizeof (buf))
|
if (ret < 0 || (unsigned int)ret >= sizeof (buf))
|
||||||
{
|
{
|
||||||
LOG_WARN("problem with formatting %s stat %s",
|
ICECAST_LOG_WARN("problem with formatting %s stat %s",
|
||||||
source==NULL ? "global" : source, name);
|
source==NULL ? "global" : source, name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -313,7 +313,7 @@ char *stats_get_value(const char *source, const char *name)
|
|||||||
void stats_event_inc(const char *source, const char *name)
|
void stats_event_inc(const char *source, const char *name)
|
||||||
{
|
{
|
||||||
stats_event_t *event = build_event (source, name, NULL);
|
stats_event_t *event = build_event (source, name, NULL);
|
||||||
/* LOG_DEBUG("%s on %s", name, source==NULL?"global":source); */
|
/* ICECAST_LOG_DEBUG("%s on %s", name, source==NULL?"global":source); */
|
||||||
if (event)
|
if (event)
|
||||||
{
|
{
|
||||||
event->action = STATS_EVENT_INC;
|
event->action = STATS_EVENT_INC;
|
||||||
@ -324,7 +324,7 @@ void stats_event_inc(const char *source, const char *name)
|
|||||||
void stats_event_add(const char *source, const char *name, unsigned long value)
|
void stats_event_add(const char *source, const char *name, unsigned long value)
|
||||||
{
|
{
|
||||||
stats_event_t *event = build_event (source, name, NULL);
|
stats_event_t *event = build_event (source, name, NULL);
|
||||||
/* LOG_DEBUG("%s on %s", name, source==NULL?"global":source); */
|
/* ICECAST_LOG_DEBUG("%s on %s", name, source==NULL?"global":source); */
|
||||||
if (event)
|
if (event)
|
||||||
{
|
{
|
||||||
event->value = malloc (16);
|
event->value = malloc (16);
|
||||||
@ -349,7 +349,7 @@ void stats_event_sub(const char *source, const char *name, unsigned long value)
|
|||||||
/* decrease the value in the provided stat by 1 */
|
/* decrease the value in the provided stat by 1 */
|
||||||
void stats_event_dec(const char *source, const char *name)
|
void stats_event_dec(const char *source, const char *name)
|
||||||
{
|
{
|
||||||
/* LOG_DEBUG("%s on %s", name, source==NULL?"global":source); */
|
/* ICECAST_LOG_DEBUG("%s on %s", name, source==NULL?"global":source); */
|
||||||
stats_event_t *event = build_event (source, name, NULL);
|
stats_event_t *event = build_event (source, name, NULL);
|
||||||
if (event)
|
if (event)
|
||||||
{
|
{
|
||||||
@ -463,7 +463,7 @@ static void modify_node_event (stats_node_t *node, stats_event_t *event)
|
|||||||
value = atoll (node->value) - atoll (event->value);
|
value = atoll (node->value) - atoll (event->value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_WARN("unhandled event (%d) for %s", event->action, event->source);
|
ICECAST_LOG_WARN("unhandled event (%d) for %s", event->action, event->source);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
str = malloc (16);
|
str = malloc (16);
|
||||||
@ -476,9 +476,9 @@ static void modify_node_event (stats_node_t *node, stats_event_t *event)
|
|||||||
free (node->value);
|
free (node->value);
|
||||||
node->value = str;
|
node->value = str;
|
||||||
if (event->source)
|
if (event->source)
|
||||||
LOG_DEBUG("update \"%s\" %s (%s)", event->source, node->name, node->value);
|
ICECAST_LOG_DEBUG("update \"%s\" %s (%s)", event->source, node->name, node->value);
|
||||||
else
|
else
|
||||||
LOG_DEBUG("update global %s (%s)", node->name, node->value);
|
ICECAST_LOG_DEBUG("update global %s (%s)", node->name, node->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ static void process_global_event (stats_event_t *event)
|
|||||||
{
|
{
|
||||||
stats_node_t *node;
|
stats_node_t *node;
|
||||||
|
|
||||||
/* LOG_DEBUG("global event %s %s %d", event->name, event->value, event->action); */
|
/* ICECAST_LOG_DEBUG("global event %s %s %d", event->name, event->value, event->action); */
|
||||||
if (event->action == STATS_EVENT_REMOVE)
|
if (event->action == STATS_EVENT_REMOVE)
|
||||||
{
|
{
|
||||||
/* we're deleting */
|
/* we're deleting */
|
||||||
@ -522,7 +522,7 @@ static void process_source_event (stats_event_t *event)
|
|||||||
snode = (stats_source_t *)calloc(1,sizeof(stats_source_t));
|
snode = (stats_source_t *)calloc(1,sizeof(stats_source_t));
|
||||||
if (snode == NULL)
|
if (snode == NULL)
|
||||||
return;
|
return;
|
||||||
LOG_DEBUG("new source stat %s", event->source);
|
ICECAST_LOG_DEBUG("new source stat %s", event->source);
|
||||||
snode->source = (char *)strdup(event->source);
|
snode->source = (char *)strdup(event->source);
|
||||||
snode->stats_tree = avl_tree_new(_compare_stats, NULL);
|
snode->stats_tree = avl_tree_new(_compare_stats, NULL);
|
||||||
if (event->action == STATS_EVENT_HIDDEN)
|
if (event->action == STATS_EVENT_HIDDEN)
|
||||||
@ -542,7 +542,7 @@ static void process_source_event (stats_event_t *event)
|
|||||||
/* adding node */
|
/* adding node */
|
||||||
if (event->value)
|
if (event->value)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("new node %s (%s)", event->name, event->value);
|
ICECAST_LOG_DEBUG("new node %s (%s)", event->name, event->value);
|
||||||
node = (stats_node_t *)calloc(1,sizeof(stats_node_t));
|
node = (stats_node_t *)calloc(1,sizeof(stats_node_t));
|
||||||
node->name = (char *)strdup(event->name);
|
node->name = (char *)strdup(event->name);
|
||||||
node->value = (char *)strdup(event->value);
|
node->value = (char *)strdup(event->value);
|
||||||
@ -554,7 +554,7 @@ static void process_source_event (stats_event_t *event)
|
|||||||
}
|
}
|
||||||
if (event->action == STATS_EVENT_REMOVE)
|
if (event->action == STATS_EVENT_REMOVE)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("delete node %s", event->name);
|
ICECAST_LOG_DEBUG("delete node %s", event->name);
|
||||||
avl_delete(snode->stats_tree, (void *)node, _free_stats);
|
avl_delete(snode->stats_tree, (void *)node, _free_stats);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -579,7 +579,7 @@ static void process_source_event (stats_event_t *event)
|
|||||||
}
|
}
|
||||||
if (event->action == STATS_EVENT_REMOVE)
|
if (event->action == STATS_EVENT_REMOVE)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("delete source node %s", event->source);
|
ICECAST_LOG_DEBUG("delete source node %s", event->source);
|
||||||
avl_delete(_stats.source_tree, (void *)snode, _free_source_stats);
|
avl_delete(_stats.source_tree, (void *)snode, _free_source_stats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -642,7 +642,7 @@ static void *_stats_thread(void *arg)
|
|||||||
stats_event (NULL, "stats_connections", "0");
|
stats_event (NULL, "stats_connections", "0");
|
||||||
stats_event (NULL, "listener_connections", "0");
|
stats_event (NULL, "listener_connections", "0");
|
||||||
|
|
||||||
LOG_INFO("stats thread started");
|
ICECAST_LOG_INFO("stats thread started");
|
||||||
while (_stats_running) {
|
while (_stats_running) {
|
||||||
thread_mutex_lock(&_global_event_mutex);
|
thread_mutex_lock(&_global_event_mutex);
|
||||||
if (_global_event_queue.head != NULL) {
|
if (_global_event_queue.head != NULL) {
|
||||||
@ -865,7 +865,7 @@ void *stats_connection(void *arg)
|
|||||||
stats_event_t *event;
|
stats_event_t *event;
|
||||||
event_listener_t listener;
|
event_listener_t listener;
|
||||||
|
|
||||||
LOG_INFO("stats client starting");
|
ICECAST_LOG_INFO("stats client starting");
|
||||||
|
|
||||||
event_queue_init (&listener.queue);
|
event_queue_init (&listener.queue);
|
||||||
/* increment the thread count */
|
/* increment the thread count */
|
||||||
@ -901,7 +901,7 @@ void *stats_connection(void *arg)
|
|||||||
|
|
||||||
thread_mutex_destroy (&listener.mutex);
|
thread_mutex_destroy (&listener.mutex);
|
||||||
client_destroy (client);
|
client_destroy (client);
|
||||||
LOG_INFO("stats client finished");
|
ICECAST_LOG_INFO("stats client finished");
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1062,7 +1062,7 @@ void stats_clear_virtual_mounts (void)
|
|||||||
{
|
{
|
||||||
/* no source_t is reserved so remove them now */
|
/* no source_t is reserved so remove them now */
|
||||||
snode = avl_get_next (snode);
|
snode = avl_get_next (snode);
|
||||||
LOG_DEBUG("releasing %s stats", src->source);
|
ICECAST_LOG_DEBUG("releasing %s stats", src->source);
|
||||||
avl_delete (_stats.source_tree, src, _free_source_stats);
|
avl_delete (_stats.source_tree, src, _free_source_stats);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
16
src/util.c
16
src/util.c
@ -319,7 +319,7 @@ char *util_url_unescape (const char *src)
|
|||||||
done = 1;
|
done = 1;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
LOG_ERROR("Fatal internal logic error in util_url_unescape()");
|
ICECAST_LOG_ERROR("Fatal internal logic error in util_url_unescape()");
|
||||||
free(decoded);
|
free(decoded);
|
||||||
return NULL;
|
return NULL;
|
||||||
break;
|
break;
|
||||||
@ -350,7 +350,7 @@ char *util_normalise_uri(const char *uri) {
|
|||||||
path = util_url_unescape(uri);
|
path = util_url_unescape(uri);
|
||||||
|
|
||||||
if(path == NULL) {
|
if(path == NULL) {
|
||||||
LOG_WARN("Error decoding URI: %s\n", uri);
|
ICECAST_LOG_WARN("Error decoding URI: %s\n", uri);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ char *util_normalise_uri(const char *uri) {
|
|||||||
if(verify_path(path))
|
if(verify_path(path))
|
||||||
return path;
|
return path;
|
||||||
else {
|
else {
|
||||||
LOG_WARN("Rejecting invalid path \"%s\"", path);
|
ICECAST_LOG_WARN("Rejecting invalid path \"%s\"", path);
|
||||||
free(path);
|
free(path);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -617,7 +617,7 @@ int util_dict_set(util_dict *dict, const char *key, const char *val)
|
|||||||
util_dict *prev;
|
util_dict *prev;
|
||||||
|
|
||||||
if (!dict || !key) {
|
if (!dict || !key) {
|
||||||
LOG_ERROR("NULL values passed to util_dict_set()");
|
ICECAST_LOG_ERROR("NULL values passed to util_dict_set()");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ int util_dict_set(util_dict *dict, const char *key, const char *val)
|
|||||||
if (!dict) {
|
if (!dict) {
|
||||||
dict = util_dict_new();
|
dict = util_dict_new();
|
||||||
if (!dict) {
|
if (!dict) {
|
||||||
LOG_ERROR("unable to allocate new dictionary");
|
ICECAST_LOG_ERROR("unable to allocate new dictionary");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (prev)
|
if (prev)
|
||||||
@ -646,13 +646,13 @@ int util_dict_set(util_dict *dict, const char *key, const char *val)
|
|||||||
prev->next = NULL;
|
prev->next = NULL;
|
||||||
util_dict_free (dict);
|
util_dict_free (dict);
|
||||||
|
|
||||||
LOG_ERROR("unable to allocate new dictionary key");
|
ICECAST_LOG_ERROR("unable to allocate new dictionary key");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dict->val = strdup(val);
|
dict->val = strdup(val);
|
||||||
if (!dict->val) {
|
if (!dict->val) {
|
||||||
LOG_ERROR("unable to allocate new dictionary value");
|
ICECAST_LOG_ERROR("unable to allocate new dictionary value");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,7 +750,7 @@ char *util_conv_string (const char *string, const char *in_charset, const char *
|
|||||||
xmlBufferPtr utf8 = xmlBufferCreate ();
|
xmlBufferPtr utf8 = xmlBufferCreate ();
|
||||||
xmlBufferPtr conv = xmlBufferCreate ();
|
xmlBufferPtr conv = xmlBufferCreate ();
|
||||||
|
|
||||||
LOG_INFO("converting metadata from %s to %s", in_charset, out_charset);
|
ICECAST_LOG_INFO("converting metadata from %s to %s", in_charset, out_charset);
|
||||||
xmlBufferCCat (orig, string);
|
xmlBufferCCat (orig, string);
|
||||||
if (xmlCharEncInFunc (in, utf8, orig) > 0)
|
if (xmlCharEncInFunc (in, utf8, orig) > 0)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,7 @@ static xsltStylesheetPtr xslt_get_stylesheet(const char *fn) {
|
|||||||
struct stat file;
|
struct stat file;
|
||||||
|
|
||||||
if(stat(fn, &file)) {
|
if(stat(fn, &file)) {
|
||||||
LOG_WARN("Error checking for stylesheet file \"%s\": %s", fn,
|
ICECAST_LOG_WARN("Error checking for stylesheet file \"%s\": %s", fn,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ static xsltStylesheetPtr xslt_get_stylesheet(const char *fn) {
|
|||||||
cache[i].stylesheet = xsltParseStylesheetFile (XMLSTR(fn));
|
cache[i].stylesheet = xsltParseStylesheetFile (XMLSTR(fn));
|
||||||
cache[i].cache_age = time(NULL);
|
cache[i].cache_age = time(NULL);
|
||||||
}
|
}
|
||||||
LOG_DEBUG("Using cached sheet %i", i);
|
ICECAST_LOG_DEBUG("Using cached sheet %i", i);
|
||||||
return cache[i].stylesheet;
|
return cache[i].stylesheet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
|
|||||||
if (cur == NULL)
|
if (cur == NULL)
|
||||||
{
|
{
|
||||||
thread_mutex_unlock(&xsltlock);
|
thread_mutex_unlock(&xsltlock);
|
||||||
LOG_ERROR("problem reading stylesheet \"%s\"", xslfilename);
|
ICECAST_LOG_ERROR("problem reading stylesheet \"%s\"", xslfilename);
|
||||||
client_send_404 (client, "Could not parse XSLT file");
|
client_send_404 (client, "Could not parse XSLT file");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_WARN("problem applying stylesheet \"%s\"", xslfilename);
|
ICECAST_LOG_WARN("problem applying stylesheet \"%s\"", xslfilename);
|
||||||
client_send_404 (client, "XSLT problem");
|
client_send_404 (client, "XSLT problem");
|
||||||
}
|
}
|
||||||
thread_mutex_unlock (&xsltlock);
|
thread_mutex_unlock (&xsltlock);
|
||||||
|
54
src/yp.c
54
src/yp.c
@ -108,7 +108,7 @@ static int handle_returned_header (void *ptr, size_t size, size_t nmemb, void *s
|
|||||||
ypdata_t *yp = stream;
|
ypdata_t *yp = stream;
|
||||||
unsigned bytes = size * nmemb;
|
unsigned bytes = size * nmemb;
|
||||||
|
|
||||||
/* LOG_DEBUG("header from YP is \"%.*s\"", bytes, ptr); */
|
/* ICECAST_LOG_DEBUG("header from YP is \"%.*s\"", bytes, ptr); */
|
||||||
if (strncasecmp (ptr, "YPResponse: 1", 13) == 0)
|
if (strncasecmp (ptr, "YPResponse: 1", 13) == 0)
|
||||||
yp->cmd_ok = 1;
|
yp->cmd_ok = 1;
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ static int handle_returned_header (void *ptr, size_t size, size_t nmemb, void *s
|
|||||||
secs = 0;
|
secs = 0;
|
||||||
if (secs < 30)
|
if (secs < 30)
|
||||||
secs = 30;
|
secs = 30;
|
||||||
LOG_DEBUG("server touch interval is %u", secs);
|
ICECAST_LOG_DEBUG("server touch interval is %u", secs);
|
||||||
yp->touch_interval = secs;
|
yp->touch_interval = secs;
|
||||||
}
|
}
|
||||||
return (int)bytes;
|
return (int)bytes;
|
||||||
@ -180,11 +180,11 @@ static void destroy_yp_server (struct yp_server *server)
|
|||||||
{
|
{
|
||||||
if (server == NULL)
|
if (server == NULL)
|
||||||
return;
|
return;
|
||||||
LOG_DEBUG("Removing YP server entry for %s", server->url);
|
ICECAST_LOG_DEBUG("Removing YP server entry for %s", server->url);
|
||||||
if (server->curl)
|
if (server->curl)
|
||||||
curl_easy_cleanup (server->curl);
|
curl_easy_cleanup (server->curl);
|
||||||
if (server->mounts) LOG_WARN("active ypdata not freed up");
|
if (server->mounts) ICECAST_LOG_WARN("active ypdata not freed up");
|
||||||
if (server->pending_mounts) LOG_WARN("pending ypdata not freed up");
|
if (server->pending_mounts) ICECAST_LOG_WARN("pending ypdata not freed up");
|
||||||
free (server->url);
|
free (server->url);
|
||||||
free (server->server_id);
|
free (server->server_id);
|
||||||
free (server);
|
free (server);
|
||||||
@ -211,7 +211,7 @@ void yp_recheck_config (ice_config_t *config)
|
|||||||
int i;
|
int i;
|
||||||
struct yp_server *server;
|
struct yp_server *server;
|
||||||
|
|
||||||
LOG_DEBUG("Updating YP configuration");
|
ICECAST_LOG_DEBUG("Updating YP configuration");
|
||||||
thread_rwlock_rlock (&yp_lock);
|
thread_rwlock_rlock (&yp_lock);
|
||||||
|
|
||||||
server = (struct yp_server *)active_yps;
|
server = (struct yp_server *)active_yps;
|
||||||
@ -263,7 +263,7 @@ void yp_recheck_config (ice_config_t *config)
|
|||||||
curl_easy_setopt (server->curl, CURLOPT_ERRORBUFFER, &(server->curl_error[0]));
|
curl_easy_setopt (server->curl, CURLOPT_ERRORBUFFER, &(server->curl_error[0]));
|
||||||
server->next = (struct yp_server *)pending_yps;
|
server->next = (struct yp_server *)pending_yps;
|
||||||
pending_yps = server;
|
pending_yps = server;
|
||||||
LOG_INFO("Adding new YP server \"%s\" (timeout %ds, default interval %ds)",
|
ICECAST_LOG_INFO("Adding new YP server \"%s\" (timeout %ds, default interval %ds)",
|
||||||
server->url, server->url_timeout, server->touch_interval);
|
server->url, server->url_timeout, server->touch_interval);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -298,7 +298,7 @@ static int send_to_yp (const char *cmd, ypdata_t *yp, char *post)
|
|||||||
int curlcode;
|
int curlcode;
|
||||||
struct yp_server *server = yp->server;
|
struct yp_server *server = yp->server;
|
||||||
|
|
||||||
/* LOG_DEBUG("send YP (%s):%s", cmd, post); */
|
/* ICECAST_LOG_DEBUG("send YP (%s):%s", cmd, post); */
|
||||||
yp->cmd_ok = 0;
|
yp->cmd_ok = 0;
|
||||||
curl_easy_setopt (server->curl, CURLOPT_POSTFIELDS, post);
|
curl_easy_setopt (server->curl, CURLOPT_POSTFIELDS, post);
|
||||||
curl_easy_setopt (server->curl, CURLOPT_WRITEHEADER, yp);
|
curl_easy_setopt (server->curl, CURLOPT_WRITEHEADER, yp);
|
||||||
@ -307,7 +307,7 @@ static int send_to_yp (const char *cmd, ypdata_t *yp, char *post)
|
|||||||
{
|
{
|
||||||
yp->process = do_yp_add;
|
yp->process = do_yp_add;
|
||||||
yp->next_update = now + 1200;
|
yp->next_update = now + 1200;
|
||||||
LOG_ERROR("connection to %s failed with \"%s\"", server->url, server->curl_error);
|
ICECAST_LOG_ERROR("connection to %s failed with \"%s\"", server->url, server->curl_error);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
if (yp->cmd_ok == 0)
|
if (yp->cmd_ok == 0)
|
||||||
@ -316,7 +316,7 @@ static int send_to_yp (const char *cmd, ypdata_t *yp, char *post)
|
|||||||
yp->error_msg = strdup ("no response from server");
|
yp->error_msg = strdup ("no response from server");
|
||||||
if (yp->process == do_yp_add)
|
if (yp->process == do_yp_add)
|
||||||
{
|
{
|
||||||
LOG_ERROR("YP %s on %s failed: %s", cmd, server->url, yp->error_msg);
|
ICECAST_LOG_ERROR("YP %s on %s failed: %s", cmd, server->url, yp->error_msg);
|
||||||
yp->next_update = now + 7200;
|
yp->next_update = now + 7200;
|
||||||
}
|
}
|
||||||
if (yp->process == do_yp_touch)
|
if (yp->process == do_yp_touch)
|
||||||
@ -331,14 +331,14 @@ static int send_to_yp (const char *cmd, ypdata_t *yp, char *post)
|
|||||||
yp->next_update = now + 1200;
|
yp->next_update = now + 1200;
|
||||||
else
|
else
|
||||||
yp->next_update = now + yp->touch_interval;
|
yp->next_update = now + yp->touch_interval;
|
||||||
LOG_INFO("YP %s on %s failed: %s", cmd, server->url, yp->error_msg);
|
ICECAST_LOG_INFO("YP %s on %s failed: %s", cmd, server->url, yp->error_msg);
|
||||||
}
|
}
|
||||||
yp->process = do_yp_add;
|
yp->process = do_yp_add;
|
||||||
free (yp->sid);
|
free (yp->sid);
|
||||||
yp->sid = NULL;
|
yp->sid = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("YP %s at %s succeeded", cmd, server->url);
|
ICECAST_LOG_DEBUG("YP %s at %s succeeded", cmd, server->url);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ static int do_yp_remove (ypdata_t *yp, char *s, unsigned len)
|
|||||||
if (ret >= (signed)len)
|
if (ret >= (signed)len)
|
||||||
return ret+1;
|
return ret+1;
|
||||||
|
|
||||||
LOG_INFO("clearing up YP entry for %s", yp->mount);
|
ICECAST_LOG_INFO("clearing up YP entry for %s", yp->mount);
|
||||||
ret = send_to_yp ("remove", yp, s);
|
ret = send_to_yp ("remove", yp, s);
|
||||||
free (yp->sid);
|
free (yp->sid);
|
||||||
yp->sid = NULL;
|
yp->sid = NULL;
|
||||||
@ -530,7 +530,7 @@ static void yp_process_server (struct yp_server *server)
|
|||||||
ypdata_t *yp;
|
ypdata_t *yp;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
/* LOG_DEBUG("processing yp server %s", server->url); */
|
/* ICECAST_LOG_DEBUG("processing yp server %s", server->url); */
|
||||||
yp = server->mounts;
|
yp = server->mounts;
|
||||||
while (yp)
|
while (yp)
|
||||||
{
|
{
|
||||||
@ -540,7 +540,7 @@ static void yp_process_server (struct yp_server *server)
|
|||||||
*/
|
*/
|
||||||
if (state == -2)
|
if (state == -2)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("skiping %s on %s", yp->mount, server->url);
|
ICECAST_LOG_DEBUG("skiping %s on %s", yp->mount, server->url);
|
||||||
yp->process = do_yp_add;
|
yp->process = do_yp_add;
|
||||||
yp->next_update += 900;
|
yp->next_update += 900;
|
||||||
}
|
}
|
||||||
@ -622,7 +622,7 @@ static void check_servers (void)
|
|||||||
if (server->remove)
|
if (server->remove)
|
||||||
{
|
{
|
||||||
struct yp_server *to_go = server;
|
struct yp_server *to_go = server;
|
||||||
LOG_DEBUG("YP server \"%s\"removed", server->url);
|
ICECAST_LOG_DEBUG("YP server \"%s\"removed", server->url);
|
||||||
*server_p = server->next;
|
*server_p = server->next;
|
||||||
server = server->next;
|
server = server->next;
|
||||||
destroy_yp_server (to_go);
|
destroy_yp_server (to_go);
|
||||||
@ -639,7 +639,7 @@ static void check_servers (void)
|
|||||||
server = (struct yp_server *)pending_yps;
|
server = (struct yp_server *)pending_yps;
|
||||||
pending_yps = server->next;
|
pending_yps = server->next;
|
||||||
|
|
||||||
LOG_DEBUG("Add pending yps %s", server->url);
|
ICECAST_LOG_DEBUG("Add pending yps %s", server->url);
|
||||||
server->next = (struct yp_server *)active_yps;
|
server->next = (struct yp_server *)active_yps;
|
||||||
active_yps = server;
|
active_yps = server;
|
||||||
|
|
||||||
@ -653,7 +653,7 @@ static void check_servers (void)
|
|||||||
source_t *source = node->key;
|
source_t *source = node->key;
|
||||||
if (source->yp_public && (yp = create_yp_entry (source->mount)) != NULL)
|
if (source->yp_public && (yp = create_yp_entry (source->mount)) != NULL)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Adding existing mount %s", source->mount);
|
ICECAST_LOG_DEBUG("Adding existing mount %s", source->mount);
|
||||||
yp->server = server;
|
yp->server = server;
|
||||||
yp->touch_interval = server->touch_interval;
|
yp->touch_interval = server->touch_interval;
|
||||||
yp->next = server->mounts;
|
yp->next = server->mounts;
|
||||||
@ -685,7 +685,7 @@ static void add_pending_yp (struct yp_server *server)
|
|||||||
yp = yp->next;
|
yp = yp->next;
|
||||||
}
|
}
|
||||||
yp->next = current;
|
yp->next = current;
|
||||||
LOG_DEBUG("%u YP entries added to %s", count, server->url);
|
ICECAST_LOG_DEBUG("%u YP entries added to %s", count, server->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -698,7 +698,7 @@ static void delete_marked_yp (struct yp_server *server)
|
|||||||
if (yp->remove)
|
if (yp->remove)
|
||||||
{
|
{
|
||||||
ypdata_t *to_go = yp;
|
ypdata_t *to_go = yp;
|
||||||
LOG_DEBUG("removed %s from YP server %s", yp->mount, server->url);
|
ICECAST_LOG_DEBUG("removed %s from YP server %s", yp->mount, server->url);
|
||||||
*prev = yp->next;
|
*prev = yp->next;
|
||||||
yp = yp->next;
|
yp = yp->next;
|
||||||
yp_destroy_ypdata (to_go);
|
yp_destroy_ypdata (to_go);
|
||||||
@ -712,7 +712,7 @@ static void delete_marked_yp (struct yp_server *server)
|
|||||||
|
|
||||||
static void *yp_update_thread(void *arg)
|
static void *yp_update_thread(void *arg)
|
||||||
{
|
{
|
||||||
LOG_INFO("YP update thread started");
|
ICECAST_LOG_INFO("YP update thread started");
|
||||||
|
|
||||||
yp_running = 1;
|
yp_running = 1;
|
||||||
while (yp_running)
|
while (yp_running)
|
||||||
@ -726,7 +726,7 @@ static void *yp_update_thread(void *arg)
|
|||||||
server = (struct yp_server *)active_yps;
|
server = (struct yp_server *)active_yps;
|
||||||
while (server)
|
while (server)
|
||||||
{
|
{
|
||||||
/* LOG_DEBUG("trying %s", server->url); */
|
/* ICECAST_LOG_DEBUG("trying %s", server->url); */
|
||||||
yp_process_server (server);
|
yp_process_server (server);
|
||||||
server = server->next;
|
server = server->next;
|
||||||
}
|
}
|
||||||
@ -740,7 +740,7 @@ static void *yp_update_thread(void *arg)
|
|||||||
server = (struct yp_server *)active_yps;
|
server = (struct yp_server *)active_yps;
|
||||||
while (server)
|
while (server)
|
||||||
{
|
{
|
||||||
/* LOG_DEBUG("Checking yps %s", server->url); */
|
/* ICECAST_LOG_DEBUG("Checking yps %s", server->url); */
|
||||||
add_pending_yp (server);
|
add_pending_yp (server);
|
||||||
delete_marked_yp (server);
|
delete_marked_yp (server);
|
||||||
server = server->next;
|
server = server->next;
|
||||||
@ -891,7 +891,7 @@ void yp_add (const char *mount)
|
|||||||
yp = create_yp_entry (mount);
|
yp = create_yp_entry (mount);
|
||||||
if (yp)
|
if (yp)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Adding %s to %s", mount, server->url);
|
ICECAST_LOG_DEBUG("Adding %s to %s", mount, server->url);
|
||||||
yp->server = server;
|
yp->server = server;
|
||||||
yp->touch_interval = server->touch_interval;
|
yp->touch_interval = server->touch_interval;
|
||||||
yp->next = server->pending_mounts;
|
yp->next = server->pending_mounts;
|
||||||
@ -901,7 +901,7 @@ void yp_add (const char *mount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LOG_DEBUG("YP entry %s already exists", mount);
|
ICECAST_LOG_DEBUG("YP entry %s already exists", mount);
|
||||||
server = server->next;
|
server = server->next;
|
||||||
}
|
}
|
||||||
thread_mutex_unlock (&yp_pending_lock);
|
thread_mutex_unlock (&yp_pending_lock);
|
||||||
@ -930,7 +930,7 @@ void yp_remove (const char *mount)
|
|||||||
list = yp->next;
|
list = yp->next;
|
||||||
continue; /* search again these are old entries */
|
continue; /* search again these are old entries */
|
||||||
}
|
}
|
||||||
LOG_DEBUG("release %s on YP %s", mount, server->url);
|
ICECAST_LOG_DEBUG("release %s on YP %s", mount, server->url);
|
||||||
yp->release = 1;
|
yp->release = 1;
|
||||||
yp->next_update = 0;
|
yp->next_update = 0;
|
||||||
}
|
}
|
||||||
@ -983,6 +983,6 @@ void yp_shutdown (void)
|
|||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
free ((char*)server_version);
|
free ((char*)server_version);
|
||||||
server_version = NULL;
|
server_version = NULL;
|
||||||
LOG_INFO("YP thread down");
|
ICECAST_LOG_INFO("YP thread down");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
src/yp.h
2
src/yp.h
@ -41,7 +41,7 @@ void yp_shutdown(void);
|
|||||||
#define yp_remove(x) do{}while(0)
|
#define yp_remove(x) do{}while(0)
|
||||||
#define yp_touch(x) do{}while(0)
|
#define yp_touch(x) do{}while(0)
|
||||||
#define yp_recheck_config(x) do{}while(0)
|
#define yp_recheck_config(x) do{}while(0)
|
||||||
#define yp_initialize() LOG_WARN("YP server handling has been disabled")
|
#define yp_initialize() ICECAST_LOG_WARN("YP server handling has been disabled")
|
||||||
#define yp_shutdown() do{}while(0)
|
#define yp_shutdown() do{}while(0)
|
||||||
|
|
||||||
#endif /* USE_YP */
|
#endif /* USE_YP */
|
||||||
|
Loading…
Reference in New Issue
Block a user