[xiph-commits] r9291 - icecast/branches/kh/icecast/src
karl at motherfish-iii.xiph.org
karl at motherfish-iii.xiph.org
Wed May 18 07:46:06 PDT 2005
Author: karl
Date: 2005-05-18 07:46:00 -0700 (Wed, 18 May 2005)
New Revision: 9291
Modified:
icecast/branches/kh/icecast/src/auth.c
icecast/branches/kh/icecast/src/connection.c
icecast/branches/kh/icecast/src/format_mp3.c
icecast/branches/kh/icecast/src/slave.c
icecast/branches/kh/icecast/src/slave.h
icecast/branches/kh/icecast/src/source.c
icecast/branches/kh/icecast/src/source.h
icecast/branches/kh/icecast/src/yp.c
icecast/branches/kh/icecast/src/yp.h
Log:
handle mount updates on active streams better. update YP and triggers for
rebuilding source stats to account for it as well
Modified: icecast/branches/kh/icecast/src/auth.c
===================================================================
--- icecast/branches/kh/icecast/src/auth.c 2005-05-17 22:40:53 UTC (rev 9290)
+++ icecast/branches/kh/icecast/src/auth.c 2005-05-18 14:46:00 UTC (rev 9291)
@@ -258,7 +258,8 @@
/* enable on-demand relay to start, wake up the slave thread */
DEBUG0("kicking off on-demand relay");
source->on_demand_req = 1;
- slave_rebuild_mounts();
+ // slave_rebuild_mounts();
+ slave_rescan ();
}
DEBUG1 ("Added client to pending on %s", source->mount);
return 0;
Modified: icecast/branches/kh/icecast/src/connection.c
===================================================================
--- icecast/branches/kh/icecast/src/connection.c 2005-05-17 22:40:53 UTC (rev 9290)
+++ icecast/branches/kh/icecast/src/connection.c 2005-05-18 14:46:00 UTC (rev 9291)
@@ -440,6 +440,7 @@
if (global.sources < config->source_limit)
{
char *contenttype;
+ mount_proxy *mountinfo;
format_type_t format_type;
http_parser_t *parser = in_parser;
@@ -503,7 +504,12 @@
}
}
- source_update_settings (config, source);
+ source->running = 1;
+ mountinfo = config_find_mount (config, source->mount);
+ if (mountinfo)
+ source_recheck_mounts ();
+ else
+ source_update_settings (config, source, mountinfo);
config_release_config();
source->shutdown_rwlock = &_source_shutdown_rwlock;
Modified: icecast/branches/kh/icecast/src/format_mp3.c
===================================================================
--- icecast/branches/kh/icecast/src/format_mp3.c 2005-05-17 22:40:53 UTC (rev 9290)
+++ icecast/branches/kh/icecast/src/format_mp3.c 2005-05-18 14:46:00 UTC (rev 9291)
@@ -198,7 +198,7 @@
{
mp3_state *source_mp3 = format->_state;
- if (mount->mp3_meta_interval <= 0)
+ if (mount == NULL || mount->mp3_meta_interval <= 0)
{
char *metadata = httpp_getvar (client->parser, "icy-metaint");
source_mp3->interval = -1;
@@ -211,7 +211,7 @@
}
else
source_mp3->interval = mount->mp3_meta_interval;
- DEBUG2 ("mp3 interval %d, %d", mount->mp3_meta_interval, source_mp3->interval);
+ DEBUG1 ("mp3 interval %d", source_mp3->interval);
}
Modified: icecast/branches/kh/icecast/src/slave.c
===================================================================
--- icecast/branches/kh/icecast/src/slave.c 2005-05-17 22:40:53 UTC (rev 9290)
+++ icecast/branches/kh/icecast/src/slave.c 2005-05-18 14:46:00 UTC (rev 9291)
@@ -121,6 +121,15 @@
}
+/* Request slave thread to rescan the existing relays to see if any need
+ * starting up, eg on-demand relays
+ */
+void slave_rescan (void)
+{
+ rescan_relays = 1;
+}
+
+
/* Request slave thread to check the relay list for changes and to
* update the stats for the current streams.
*/
@@ -366,15 +375,13 @@
if (relay->on_demand)
{
ice_config_t *config = config_get_config ();
- source_update_settings (config, relay->source);
- if (relay->source->yp_public)
- yp_add (relay->source);
+ mount_proxy *mountinfo = config_find_mount (config, relay->localmount);
+ if (mountinfo)
+ slave_rebuild_mounts();
+ else
+ source_update_settings (config, relay->source, mountinfo);
config_release_config ();
stats_event (relay->localmount, "listeners", "0");
-
- /* on-demand relays can be used as fallback mounts so we need
- * to recheck other mountpoints for the xsl pages */
- slave_rebuild_mounts();
}
}
else
@@ -422,7 +429,8 @@
if (relay->on_demand)
{
ice_config_t *config = config_get_config ();
- source_update_settings (config, relay->source);
+ mount_proxy *mountinfo = config_find_mount (config, relay->localmount);
+ source_update_settings (config, relay->source, mountinfo);
config_release_config ();
stats_event (relay->localmount, "listeners", "0");
}
Modified: icecast/branches/kh/icecast/src/slave.h
===================================================================
--- icecast/branches/kh/icecast/src/slave.h 2005-05-17 22:40:53 UTC (rev 9290)
+++ icecast/branches/kh/icecast/src/slave.h 2005-05-18 14:46:00 UTC (rev 9291)
@@ -45,6 +45,7 @@
void slave_shutdown(void);
void slave_recheck_mounts (void);
void slave_rebuild_mounts (void);
+void slave_rescan (void);
int slave_redirect (const char *mountpoint, struct _client_tag *client);
void slave_host_add (struct _client_tag *client, const char *header);
void slave_host_remove (struct _client_tag *client);
Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c 2005-05-17 22:40:53 UTC (rev 9290)
+++ icecast/branches/kh/icecast/src/source.c 2005-05-18 14:46:00 UTC (rev 9291)
@@ -244,8 +244,6 @@
source->no_mount = 0;
source->shoutcast_compat = 0;
source->max_listeners = -1;
- source->yp_public = -1;
- source->yp_prevent = 0;
source->hidden = 0;
source->client_stats_update = 0;
util_dict_free (source->audio_info);
@@ -509,6 +507,7 @@
{
if (source->last_read + (time_t)source->timeout < current)
{
+ DEBUG2 ("last read is %ld, current is %ld", source->last_read, current);
WARN0 ("Disconnecting source due to socket timeout");
source->running = 0;
break;
@@ -739,27 +738,7 @@
struct tm local;
thread_mutex_lock (&source->lock);
- if (source->yp_public < 0)
- {
- do
- {
- if (source->yp_prevent)
- break;
- if ((str = httpp_getvar (source->client->parser, "ice-public")))
- break;
- if ((str = httpp_getvar (source->client->parser, "icy-pub")))
- break;
- if ((str = httpp_getvar (source->client->parser, "x-audiocast-public")))
- break;
- /* handle header from icecast v2 release */
- if ((str = httpp_getvar (source->client->parser, "icy-public")))
- break;
- str = "0";
- } while (0);
- source->yp_public = atoi (str);
- stats_event (source->mount, "public", str);
- }
stats_event (source->mount, "server_type", source->format->contenttype);
if (source->dumpfilename != NULL)
@@ -825,10 +804,7 @@
avl_tree_unlock(global.source_tree);
}
- slave_rebuild_mounts ();
thread_mutex_lock (&source->lock);
- if (source->on_demand == 0 && source->yp_public)
- yp_add (source);
}
@@ -999,60 +975,189 @@
}
+/* Apply the mountinfo details to the source */
static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
{
- if (strcmp (mountinfo->mountname, source->mount) == 0)
+ char *str;
+ int val;
+ http_parser_t *parser = NULL;
+
+ if (mountinfo == NULL || strcmp (mountinfo->mountname, source->mount) == 0)
INFO1 ("Applying mount information for \"%s\"", source->mount);
else
INFO2 ("Applying mount information for \"%s\" from \"%s\"",
source->mount, mountinfo->mountname);
- source->max_listeners = mountinfo->max_listeners;
- source->fallback_override = mountinfo->fallback_override;
- source->no_mount = mountinfo->no_mount;
- source->hidden = mountinfo->hidden;
- source->yp_public = mountinfo->yp_public;
- if (mountinfo->yp_public >= 0)
- stats_event_args (source->mount, "public", "%d", mountinfo->yp_public);
+ if (mountinfo)
+ {
+ source->max_listeners = mountinfo->max_listeners;
+ source->fallback_override = mountinfo->fallback_override;
+ source->no_mount = mountinfo->no_mount;
+ source->hidden = mountinfo->hidden;
+ }
- if (mountinfo->stream_name)
- stats_event (source->mount, "server_name", mountinfo->stream_name);
+ /* if a setting is available in the mount details then use it, else
+ * check the parser details. */
- if (mountinfo->stream_description)
- stats_event (source->mount, "server_description", mountinfo->stream_description);
+ if (source->client)
+ parser = source->client->parser;
- if (mountinfo->stream_url)
- stats_event (source->mount, "server_url", mountinfo->stream_url);
+ /* public */
+ if (mountinfo && mountinfo->yp_public >= 0)
+ val = mountinfo->yp_public;
+ else
+ {
+ do {
+ str = httpp_getvar (parser, "ice-public");
+ if (str) break;
+ str = httpp_getvar (parser, "icy-pub");
+ if (str) break;
+ str = httpp_getvar (parser, "x-audiocast-public");
+ if (str) break;
+ /* handle header from icecast v2 release */
+ str = httpp_getvar (parser, "icy-public");
+ if (str) break;
+ str = "0";
+ } while (0);
+ val = atoi (str);
+ }
+ stats_event_args (source->mount, "public", "%d", val);
+ if (source->yp_public != val)
+ {
+ DEBUG1 ("YP changed to %d", val);
+ if (val)
+ yp_add (source->mount);
+ else
+ yp_remove (source->mount);
+ source->yp_public = val;
+ }
- if (mountinfo->stream_genre)
- stats_event (source->mount, "genre", mountinfo->stream_genre);
+ /* stream name */
+ if (mountinfo && mountinfo->stream_name)
+ str = mountinfo->stream_name;
+ else
+ {
+ do {
+ str = httpp_getvar (parser, "ice-name");
+ if (str) break;
+ str = httpp_getvar (parser, "icy-name");
+ if (str) break;
+ str = httpp_getvar (parser, "x-audiocast-name");
+ if (str) break;
+ str = "Unspecified name";
+ } while (0);
+ }
+ stats_event (source->mount, "server_name", str);
- if (mountinfo->bitrate)
- stats_event (source->mount, "bitrate", mountinfo->bitrate);
+ /* stream description */
+ if (mountinfo && mountinfo->stream_description)
+ str = mountinfo->stream_description;
+ else
+ {
+ do {
+ str = httpp_getvar (parser, "ice-description");
+ if (str) break;
+ str = httpp_getvar (parser, "icy-description");
+ if (str) break;
+ str = httpp_getvar (parser, "x-audiocast-description");
+ if (str) break;
+ str = "Unspecified description";
+ } while (0);
+ }
+ stats_event (source->mount, "server_description", str);
- if (mountinfo->type)
+ /* stream URL */
+ if (mountinfo && mountinfo->stream_url)
+ str = mountinfo->stream_url;
+ else
+ {
+ do {
+ str = httpp_getvar (parser, "ice-url");
+ if (str) break;
+ str = httpp_getvar (parser, "icy-url");
+ if (str) break;
+ str = httpp_getvar (parser, "x-audiocast-url");
+ if (str) break;
+ } while (0);
+ }
+ stats_event (source->mount, "server_url", str);
+
+ /* stream genre */
+ if (mountinfo && mountinfo->stream_genre)
+ str = mountinfo->stream_genre;
+ else
+ {
+ do {
+ str = httpp_getvar (parser, "ice-genre");
+ if (str) break;
+ str = httpp_getvar (parser, "icy-genre");
+ if (str) break;
+ str = httpp_getvar (parser, "x-audiocast-genre");
+ if (str) break;
+ str = "various";
+ } while (0);
+ }
+ stats_event (source->mount, "genre", str);
+
+ /* stream bitrate */
+ if (mountinfo && mountinfo->bitrate)
+ str = mountinfo->bitrate;
+ else
+ {
+ do {
+ str = httpp_getvar (parser, "ice-bitrate");
+ if (str) break;
+ str = httpp_getvar (parser, "icy-br");
+ if (str) break;
+ str = httpp_getvar (parser, "x-audiocast-bitrate");
+ } while (0);
+ }
+ stats_event (source->mount, "bitrate", str);
+
+ /* handle MIME-type */
+ if (mountinfo && mountinfo->type)
stats_event (source->mount, "server_type", mountinfo->type);
+ else
+ if (source->format)
+ stats_event (source->mount, "server_type", source->format->contenttype);
- if (mountinfo->subtype)
+ if (mountinfo && mountinfo->subtype)
stats_event (source->mount, "subtype", mountinfo->subtype);
- if (mountinfo->auth)
+ if (mountinfo && mountinfo->auth)
stats_event (source->mount, "authenticator", mountinfo->auth->type);
else
stats_event (source->mount, "authenticator", NULL);
- if (mountinfo->fallback_mount)
- {
- free (source->fallback_mount);
+
+ free (source->fallback_mount);
+ source->fallback_mount = NULL;
+ if (mountinfo && mountinfo->fallback_mount)
source->fallback_mount = strdup (mountinfo->fallback_mount);
- }
- if (mountinfo->dumpfile)
+
+ /* needs a better mechanism, probably via a client_t handle */
+ if (mountinfo && mountinfo->dumpfile)
{
free (source->dumpfilename);
source->dumpfilename = strdup (mountinfo->dumpfile);
}
+ /* handle changes in intro file setting */
if (source->intro_file)
+ {
+ int close_it = 0;
+ if (mountinfo)
+ {
+ if (mountinfo->intro_filename && strcmp (mountinfo->intro_filename,
+ source->intro_filename) != 0)
+ close_it = 1;
+ }
+ else
+ close_it = 1;
fclose (source->intro_file);
- if (mountinfo->intro_filename)
+ source->intro_file = NULL;
+ free (source->intro_filename);
+ source->intro_filename = NULL;
+ }
+ if (mountinfo && mountinfo->intro_filename)
{
ice_config_t *config = config_get_config_unlocked ();
unsigned int len = strlen (config->webroot_dir) +
@@ -1070,118 +1175,58 @@
}
}
- if (mountinfo->queue_size_limit)
+ if (mountinfo && mountinfo->queue_size_limit)
source->queue_size_limit = mountinfo->queue_size_limit;
- if (mountinfo->source_timeout)
+ if (mountinfo && mountinfo->source_timeout)
source->timeout = mountinfo->source_timeout;
- if (mountinfo->burst_size >= 0)
+ if (mountinfo && mountinfo->burst_size >= 0)
source->burst_size = (unsigned int)mountinfo->burst_size;
- if (mountinfo->fallback_when_full)
+ if (mountinfo && mountinfo->fallback_when_full)
source->fallback_when_full = mountinfo->fallback_when_full;
- if (mountinfo->no_yp)
- source->yp_prevent = 1;
+ free (source->on_connect);
+ source->on_connect = NULL;
+ if (mountinfo && mountinfo->on_connect)
+ source->on_connect = strdup (mountinfo->on_connect);
- if (mountinfo->on_connect)
- {
- free (source->on_connect);
- source->on_connect = strdup(mountinfo->on_connect);
- }
+ free (source->on_disconnect);
+ source->on_disconnect = NULL;
+ if (mountinfo && mountinfo->on_disconnect)
+ source->on_disconnect = strdup (mountinfo->on_disconnect);
- if (mountinfo->on_disconnect)
- {
- free (source->on_disconnect);
- source->on_disconnect = strdup(mountinfo->on_disconnect);
- }
if (source->format && source->format->apply_settings)
source->format->apply_settings (source->client, source->format, mountinfo);
}
-void source_update_settings (ice_config_t *config, source_t *source)
+/* update the specified source with details from the config or mount.
+ * mountinfo can be NULL in which case default settings should be taken
+ */
+void source_update_settings (ice_config_t *config, source_t *source, mount_proxy *mountinfo)
{
- mount_proxy *mountinfo = config_find_mount (config, source->mount);
- char *str;
-
thread_mutex_lock (&source->lock);
/* set global settings first */
source->queue_size_limit = config->queue_size_limit;
source->timeout = config->source_timeout;
source->burst_size = config->burst_size;
- source->dumpfilename = NULL;
- if (source->client)
- {
- http_parser_t *parser = source->client->parser;
- do {
- str = httpp_getvar(parser, "ice-name");
- if (str) break;
- str = httpp_getvar(parser, "icy-name");
- if (str) break;
- str = httpp_getvar(parser, "x-audiocast-name");
- } while (0);
- if (str)
- stats_event (source->mount, "server_name", str);
+ source_apply_mount (source, mountinfo);
- do {
- str = httpp_getvar(parser, "ice-description");
- if (str) break;
- str = httpp_getvar(parser, "icy-description");
- if (str) break;
- str = httpp_getvar(parser, "x-audiocast-description");
- } while (0);
- if (str)
- stats_event (source->mount, "server_description", str);
-
- do {
- str = httpp_getvar(parser, "ice-genre");
- if (str) break;
- str = httpp_getvar(parser, "icy-genre");
- if (str) break;
- str = httpp_getvar(parser, "x-audiocast-genre");
- } while (0);
- if (str)
- stats_event (source->mount, "genre", str);
-
- do {
- str = httpp_getvar(parser, "ice-url");
- if (str) break;
- str = httpp_getvar(parser, "icy-url");
- if (str) break;
- str = httpp_getvar(parser, "x-audiocast-url");
- } while (0);
- if (str)
- stats_event (source->mount, "server_url", str);
-
- do {
- str = httpp_getvar(parser, "ice-bitrate");
- if (str) break;
- str = httpp_getvar(parser, "icy-br");
- if (str) break;
- str = httpp_getvar(parser, "x-audiocast-bitrate");
- } while (0);
- if (str)
- stats_event (source->mount, "bitrate", str);
- }
-
- if (mountinfo)
- source_apply_mount (source, mountinfo);
-
if (source->fallback_mount)
DEBUG1 ("fallback %s", source->fallback_mount);
+ if (source->intro_filename)
+ DEBUG1 ("intro file is %s", source->intro_filename);
if (source->dumpfilename)
DEBUG1 ("Dumping stream to %s", source->dumpfilename);
- if (source->yp_prevent)
- DEBUG0 ("preventing YP listings");
if (source->on_connect)
DEBUG1 ("connect script \"%s\"", source->on_connect);
if (source->on_disconnect)
DEBUG1 ("disconnect script \"%s\"", source->on_disconnect);
if (source->on_demand)
- DEBUG0 ("on-demand set");
+ DEBUG0 ("on_demand set");
if (source->hidden)
{
stats_event_hidden (source->mount, NULL, 1);
@@ -1199,10 +1244,11 @@
stats_event (source->mount, "max_listeners", buf);
}
if (source->on_demand)
- stats_event (source->mount, "on-demand", "1");
+ stats_event (source->mount, "on_demand", "1");
else
- stats_event (source->mount, "on-demand", NULL);
+ stats_event (source->mount, "on_demand", NULL);
+ DEBUG1 ("public set to %d", source->yp_public);
DEBUG1 ("max listeners to %d", source->max_listeners);
DEBUG1 ("queue size to %u", source->queue_size_limit);
DEBUG1 ("burst size to %u", source->burst_size);
@@ -1237,7 +1283,7 @@
source_main (source);
source_free_source (source);
- slave_rebuild_mounts ();
+ source_recheck_mounts ();
return NULL;
}
@@ -1322,7 +1368,7 @@
httpp_setvar (parser, "content-type", type);
source->hidden = 1;
- source->yp_prevent = 1;
+ source->yp_public = 0;
source->intro_file = file;
file = NULL;
@@ -1349,34 +1395,19 @@
while (mount)
{
- int update_stats = 0;
- int hidden;
source_t *source = source_find_mount (mount->mountname);
- hidden = mount->hidden;
if (source)
{
- /* something is active, maybe a fallback */
- if (strcmp (source->mount, mount->mountname) == 0)
+ source = source_find_mount_raw (mount->mountname);
+ if (source)
{
- /* normally the source thread would deal with this there
- * isn't one for inactive on-demand relays */
- if (source->on_demand && source->running == 0)
- update_stats = 1;
+ mount_proxy *mountinfo = config_find_mount (config, source->mount);
+ source_update_settings (config, source, mountinfo);
}
else
- update_stats = 1;
- }
- else
- stats_event (mount->mountname, NULL, NULL);
- if (update_stats)
- {
- source = source_find_mount_raw (mount->mountname);
- if (source)
- source_update_settings (config, source);
- else
{
- stats_event_hidden (mount->mountname, NULL, hidden);
+ stats_event_hidden (mount->mountname, NULL, mount->hidden);
stats_event (mount->mountname, "listeners", "0");
if (mount->max_listeners < 0)
stats_event (mount->mountname, "max_listeners", "unlimited");
@@ -1384,6 +1415,9 @@
stats_event_args (mount->mountname, "max_listeners", "%d", mount->max_listeners);
}
}
+ else
+ stats_event (mount->mountname, NULL, NULL);
+
/* check for fallback to file */
if (global.running == ICE_RUNNING && mount->fallback_mount)
{
Modified: icecast/branches/kh/icecast/src/source.h
===================================================================
--- icecast/branches/kh/icecast/src/source.h 2005-05-17 22:40:53 UTC (rev 9290)
+++ icecast/branches/kh/icecast/src/source.h 2005-05-18 14:46:00 UTC (rev 9291)
@@ -46,13 +46,15 @@
rwlock_t *shutdown_rwlock;
util_dict *audio_info;
+ /* name of a file, whose contents are sent at listener connection */
+ char *intro_filename;
+
char *dumpfilename; /* Name of a file to dump incoming stream to */
FILE *dumpfile;
unsigned int listeners;
long max_listeners;
int yp_public;
- int yp_prevent;
int fallback_override;
int fallback_when_full;
int no_mount;
@@ -86,7 +88,7 @@
source_t *source_reserve (const char *mount);
void *source_client_thread (void *arg);
-void source_update_settings (ice_config_t *config, source_t *source);
+void source_update_settings (ice_config_t *config, source_t *source, mount_proxy *mountinfo);
void source_clear_source (source_t *source);
source_t *source_find_mount(const char *mount);
source_t *source_find_mount_raw(const char *mount);
Modified: icecast/branches/kh/icecast/src/yp.c
===================================================================
--- icecast/branches/kh/icecast/src/yp.c 2005-05-17 22:40:53 UTC (rev 9290)
+++ icecast/branches/kh/icecast/src/yp.c 2005-05-18 14:46:00 UTC (rev 9291)
@@ -362,6 +362,10 @@
add_yp_info (yp, value, YP_SUBTYPE);
free (value);
+ value = stats_get_value (yp->mount, "audio_info");
+ add_yp_info (yp, value, YP_AUDIO_INFO);
+ free (value);
+
ret = snprintf (s, len, "action=add&sn=%s&genre=%s&cpswd=%s&desc="
"%s&url=%s&listenurl=%s&type=%s&stype=%s&b=%s&%s\r\n",
yp->server_name, yp->server_genre, yp->cluster_password,
@@ -494,13 +498,11 @@
-static ypdata_t *create_yp_entry (source_t *source)
+static ypdata_t *create_yp_entry (const char *mount)
{
ypdata_t *yp;
char *s;
- if ((source->running == 0 && source->on_demand == 0) || source->yp_public == 0)
- return NULL;
yp = calloc (1, sizeof (ypdata_t));
do
{
@@ -512,7 +514,7 @@
if (yp == NULL)
break;
- yp->mount = strdup (source->mount);
+ yp->mount = strdup (mount);
yp->server_name = strdup ("");
yp->server_desc = strdup ("");
yp->server_genre = strdup ("");
@@ -529,34 +531,24 @@
if (url == NULL)
break;
config = config_get_config();
- ret = snprintf (url, len, "http://%s:%d%s", config->hostname, config->port, source->mount);
+ ret = snprintf (url, len, "http://%s:%d%s", config->hostname, config->port, mount);
if (ret >= (signed)len)
{
s = realloc (url, ++ret);
if (s) url = s;
- snprintf (url, ret, "http://%s:%d%s", config->hostname, config->port, source->mount);
+ snprintf (url, ret, "http://%s:%d%s", config->hostname, config->port, mount);
}
- mountproxy = config->mounts;
- while (mountproxy) {
- if (strcmp (mountproxy->mountname, source->mount) == 0) {
- if (mountproxy->cluster_password) {
- add_yp_info (yp, mountproxy->cluster_password, YP_CLUSTER_PASSWORD);
- }
- break;
- }
- mountproxy = mountproxy->next;
- }
+ mountproxy = config_find_mount (config, mount);
+ if (mountproxy && mountproxy->cluster_password)
+ add_yp_info (yp, mountproxy->cluster_password, YP_CLUSTER_PASSWORD);
config_release_config();
+
yp->listen_url = util_url_escape (url);
free (url);
if (yp->listen_url == NULL)
break;
- s = util_dict_urlencode (source->audio_info, '&');
- if (s)
- add_yp_info (yp, s, YP_AUDIO_INFO);
- free(s);
return yp;
} while (0);
@@ -606,7 +598,7 @@
source_t *source = node->key;
thread_mutex_lock (&source->lock);
- if ((yp = create_yp_entry (source)) != NULL)
+ if ((yp = create_yp_entry (source->mount)) != NULL)
{
DEBUG1 ("Adding existing mount %s", source->mount);
yp->server = server;
@@ -864,7 +856,7 @@
/* Add YP entries to active servers */
-void yp_add (source_t *source)
+void yp_add (const char *mount)
{
struct yp_server *server;
@@ -880,14 +872,14 @@
/* check if YP entry is known about, as source_t is unique this
* should only apply to the restarting of on-demand relays */
- yp = find_yp_mount (server->mounts, source->mount);
+ yp = find_yp_mount (server->mounts, mount);
if (yp == NULL)
{
/* add new ypdata to each servers pending yp */
- yp = create_yp_entry (source);
+ yp = create_yp_entry (mount);
if (yp)
{
- DEBUG2 ("Adding %s to %s", source->mount, server->url);
+ DEBUG2 ("Adding %s to %s", mount, server->url);
yp->server = server;
yp->touch_interval = server->touch_interval;
yp->next = server->pending_mounts;
@@ -897,12 +889,11 @@
}
}
else
- DEBUG1 ("YP entry %s already exists", source->mount);
+ DEBUG1 ("YP entry %s already exists", mount);
server = server->next;
}
thread_mutex_unlock (&yp_pending_lock);
thread_rwlock_unlock (&yp_lock);
- /* DEBUG1 ("Added %s to YP ", source->mount); */
}
Modified: icecast/branches/kh/icecast/src/yp.h
===================================================================
--- icecast/branches/kh/icecast/src/yp.h 2005-05-17 22:40:53 UTC (rev 9290)
+++ icecast/branches/kh/icecast/src/yp.h 2005-05-18 14:46:00 UTC (rev 9291)
@@ -25,12 +25,10 @@
#define YP_CLUSTER_PASSWORD 9
#define YP_SUBTYPE 10
-struct source_tag;
-
#define YP_ADD_ALL -1
#ifdef USE_YP
-void yp_add (struct source_tag *source);
+void yp_add (const char *mount);
void yp_remove (const char *mount);
void yp_touch (const char *mount);
void yp_recheck_config (ice_config_t *config);
More information about the commits
mailing list