1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-09-29 04:25:55 -04:00

resync with fixes in trunk

svn path=/icecast/branches/kh/icecast/; revision=9881
This commit is contained in:
Karl Heyes 2005-08-31 17:33:04 +00:00
parent 338c2c8291
commit c5455bc7f8
4 changed files with 23 additions and 10 deletions

View File

@ -837,7 +837,7 @@ static void command_buildm3u(client_t *client, source_t *source,
client->respcode = 200; client->respcode = 200;
config = config_get_config(); config = config_get_config();
snprintf (client->refbuf->data, client->refbuf->len, snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 200 OK\r\n" "HTTP/1.0 200 OK\r\n"
"Content-Type: audio/x-mpegurl\r\n" "Content-Type: audio/x-mpegurl\r\n"
"Content-Disposition = attachment; filename=listen.m3u\r\n\r\n" "Content-Disposition = attachment; filename=listen.m3u\r\n\r\n"

View File

@ -129,8 +129,16 @@ static void htpasswd_recheckfile (htpasswd_auth_state *htpasswd)
if (stat (htpasswd->filename, &file_stat) < 0) if (stat (htpasswd->filename, &file_stat) < 0)
{ {
WARN1 ("failed to check status of %s", htpasswd->filename); WARN1 ("failed to check status of %s", htpasswd->filename);
/* Create a dummy users tree for things to use later */
thread_rwlock_wlock (&htpasswd->file_rwlock);
if(!htpasswd->users)
htpasswd->users = avl_tree_new(compare_users, NULL);
thread_rwlock_unlock (&htpasswd->file_rwlock);
return; return;
} }
if (file_stat.st_mtime == htpasswd->mtime) if (file_stat.st_mtime == htpasswd->mtime)
{ {
/* common case, no update to file */ /* common case, no update to file */

View File

@ -197,7 +197,7 @@ static void format_mp3_apply_settings (client_t *client, format_plugin_t *format
{ {
mp3_state *source_mp3 = format->_state; mp3_state *source_mp3 = format->_state;
if (mount == NULL || mount->mp3_meta_interval <= 0) if (mount == NULL || mount->mp3_meta_interval < 0)
{ {
char *metadata = httpp_getvar (client->parser, "icy-metaint"); char *metadata = httpp_getvar (client->parser, "icy-metaint");
source_mp3->interval = -1; source_mp3->interval = -1;
@ -376,6 +376,9 @@ static int format_mp3_write_buf_to_client (client_t *client)
/* change buf and len */ /* change buf and len */
buf += remaining; buf += remaining;
len -= remaining; len -= remaining;
/* limit how much mp3 we send if using small intervals */
if (len > client_mp3->interval)
len = client_mp3->interval;
} }
} }
/* write any mp3, maybe after the metadata block */ /* write any mp3, maybe after the metadata block */
@ -640,16 +643,19 @@ static int format_mp3_create_client_data(source_t *source, client_t *client)
metadata = httpp_getvar(client->parser, "icy-metadata"); metadata = httpp_getvar(client->parser, "icy-metadata");
if (metadata && atoi(metadata)) if (metadata && atoi(metadata))
{ {
if (source_mp3->interval > 0) if (source_mp3->interval >= 0)
client_mp3->interval = source_mp3->interval; client_mp3->interval = source_mp3->interval;
else else
client_mp3->interval = ICY_METADATA_INTERVAL; client_mp3->interval = ICY_METADATA_INTERVAL;
bytes = snprintf (ptr, remaining, "icy-metaint:%u\r\n", if (client_mp3->interval)
client_mp3->interval);
if (bytes > 0)
{ {
remaining -= bytes; bytes = snprintf (ptr, remaining, "icy-metaint:%u\r\n",
ptr += bytes; client_mp3->interval);
if (bytes > 0)
{
remaining -= bytes;
ptr += bytes;
}
} }
} }
bytes = snprintf (ptr, remaining, "\r\n"); bytes = snprintf (ptr, remaining, "\r\n");

View File

@ -833,8 +833,7 @@ void yp_add (const char *mount)
{ {
ypdata_t *yp; ypdata_t *yp;
/* check if YP entry is known about, as source_t is unique this /* on-demand relays may already have a YP entry */
* should only apply to the restarting of on-demand relays */
yp = find_yp_mount (server->mounts, mount); yp = find_yp_mount (server->mounts, mount);
if (yp == NULL) if (yp == NULL)
{ {