[xiph-commits] r13704 - icecast/trunk/icecast/src
karl at svn.xiph.org
karl at svn.xiph.org
Sun Sep 2 17:55:28 PDT 2007
Author: karl
Date: 2007-09-02 17:55:27 -0700 (Sun, 02 Sep 2007)
New Revision: 13704
Modified:
icecast/trunk/icecast/src/cfgfile.c
icecast/trunk/icecast/src/cfgfile.h
icecast/trunk/icecast/src/format.c
icecast/trunk/icecast/src/format_vorbis.c
icecast/trunk/icecast/src/slave.c
icecast/trunk/icecast/src/stats.c
icecast/trunk/icecast/src/yp.c
Log:
close report #704, add server-id tag, default stays as the server version string.
Modified: icecast/trunk/icecast/src/cfgfile.c
===================================================================
--- icecast/trunk/icecast/src/cfgfile.c 2007-09-02 23:48:51 UTC (rev 13703)
+++ icecast/trunk/icecast/src/cfgfile.c 2007-09-03 00:55:27 UTC (rev 13704)
@@ -337,6 +337,7 @@
static void _set_defaults(ice_config_t *configuration)
{
configuration->location = CONFIG_DEFAULT_LOCATION;
+ configuration->server_id = (char *)xmlCharStrdup (ICECAST_VERSION_STRING);
configuration->admin = CONFIG_DEFAULT_ADMIN;
configuration->client_limit = CONFIG_DEFAULT_CLIENT_LIMIT;
configuration->source_limit = CONFIG_DEFAULT_SOURCE_LIMIT;
@@ -397,6 +398,9 @@
} else if (strcmp(node->name, "admin") == 0) {
if (configuration->admin && configuration->admin != CONFIG_DEFAULT_ADMIN) xmlFree(configuration->admin);
configuration->admin = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+ } else if (strcmp(node->name, "server-id") == 0) {
+ xmlFree (configuration->server_id);
+ configuration->server_id = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if(strcmp(node->name, "authentication") == 0) {
_parse_authentication(doc, node->xmlChildrenNode, configuration);
} else if (strcmp(node->name, "source-password") == 0) {
Modified: icecast/trunk/icecast/src/cfgfile.h
===================================================================
--- icecast/trunk/icecast/src/cfgfile.h 2007-09-02 23:48:51 UTC (rev 13703)
+++ icecast/trunk/icecast/src/cfgfile.h 2007-09-03 00:55:27 UTC (rev 13704)
@@ -147,6 +147,7 @@
mount_proxy *mounts;
+ char *server_id;
char *base_dir;
char *log_dir;
char *pidfile;
Modified: icecast/trunk/icecast/src/format.c
===================================================================
--- icecast/trunk/icecast/src/format.c 2007-09-02 23:48:51 UTC (rev 13703)
+++ icecast/trunk/icecast/src/format.c 2007-09-03 00:55:27 UTC (rev 13704)
@@ -271,6 +271,7 @@
int bytes;
int bitrate_filtered = 0;
avl_node *node;
+ ice_config_t *config;
remaining = client->refbuf->len;
ptr = client->refbuf->data;
@@ -340,7 +341,9 @@
}
avl_tree_unlock(source->parser->vars);
- bytes = snprintf (ptr, remaining, "Server: %s\r\n", ICECAST_VERSION_STRING);
+ config = config_get_config();
+ bytes = snprintf (ptr, remaining, "Server: %s\r\n", config->server_id);
+ config_release_config();
remaining -= bytes;
ptr += bytes;
Modified: icecast/trunk/icecast/src/format_vorbis.c
===================================================================
--- icecast/trunk/icecast/src/format_vorbis.c 2007-09-02 23:48:51 UTC (rev 13703)
+++ icecast/trunk/icecast/src/format_vorbis.c 2007-09-03 00:55:27 UTC (rev 13704)
@@ -325,13 +325,16 @@
{
vorbis_comment vc;
ogg_packet header;
+ ice_config_t *config;
vorbis_comment_init (&vc);
if (ogg_info->artist)
vorbis_comment_add_tag (&vc, "artist", ogg_info->artist);
if (ogg_info->title)
vorbis_comment_add_tag (&vc, "title", ogg_info->title);
- vorbis_comment_add_tag (&vc, "server", ICECAST_VERSION_STRING);
+ config = config_get_config();
+ vorbis_comment_add_tag (&vc, "server", config->server_id);
+ config_release_config();
vorbis_commentheader_out (&vc, &header);
ogg_stream_packetin (&source_vorbis->new_os, &header);
Modified: icecast/trunk/icecast/src/slave.c
===================================================================
--- icecast/trunk/icecast/src/slave.c 2007-09-02 23:48:51 UTC (rev 13703)
+++ icecast/trunk/icecast/src/slave.c 2007-09-03 00:55:27 UTC (rev 13704)
@@ -153,6 +153,8 @@
static client_t *open_relay_connection (relay_server *relay)
{
int redirects = 0;
+ char *server_id = NULL;
+ ice_config_t *config;
http_parser_t *parser = NULL;
connection_t *con=NULL;
char *server = strdup (relay->server);
@@ -161,6 +163,10 @@
char *auth_header;
char header[4096];
+ config = config_get_config ();
+ server_id = strdup (config->server_id);
+ config_release_config ();
+
/* build any authentication header before connecting */
if (relay->username && relay->password)
{
@@ -205,7 +211,7 @@
"%s"
"\r\n",
mount,
- ICECAST_VERSION_STRING,
+ server_id,
relay->mp3metadata?"Icy-MetaData: 1\r\n":"",
auth_header);
memset (header, 0, sizeof(header));
@@ -277,6 +283,7 @@
client_set_queue (client, NULL);
free (server);
free (mount);
+ free (server_id);
free (auth_header);
return client;
@@ -286,6 +293,7 @@
/* failed, better clean up */
free (server);
free (mount);
+ free (server_id);
free (auth_header);
if (con)
connection_close (con);
Modified: icecast/trunk/icecast/src/stats.c
===================================================================
--- icecast/trunk/icecast/src/stats.c 2007-09-02 23:48:51 UTC (rev 13703)
+++ icecast/trunk/icecast/src/stats.c 2007-09-03 00:55:27 UTC (rev 13704)
@@ -589,6 +589,7 @@
void stats_global (ice_config_t *config)
{
+ stats_event (NULL, "server_id", config->server_id);
stats_event (NULL, "host", config->hostname);
stats_event (NULL, "location", config->location);
stats_event (NULL, "admin", config->admin);
@@ -601,7 +602,6 @@
stats_event_t *copy;
event_listener_t *listener;
- stats_event (NULL, "server", ICECAST_VERSION_STRING);
stats_event_time (NULL, "server_start");
/* global currently active stats */
Modified: icecast/trunk/icecast/src/yp.c
===================================================================
--- icecast/trunk/icecast/src/yp.c 2007-09-02 23:48:51 UTC (rev 13703)
+++ icecast/trunk/icecast/src/yp.c 2007-09-03 00:55:27 UTC (rev 13704)
@@ -91,6 +91,7 @@
static time_t now;
static thread_type *yp_thread;
static volatile unsigned client_limit = 0;
+static volatile char *server_version = NULL;
static void *yp_update_thread(void *arg);
static void add_yp_info (ypdata_t *yp, void *info, int type);
@@ -217,6 +218,8 @@
server = server->next;
}
client_limit = config->client_limit;
+ free ((char*)server_version);
+ server_version = strdup (config->server_id);
/* for each yp url in config, check to see if one exists
if not, then add it. */
for (i=0 ; i < config->num_yp_directories; i++)
@@ -242,7 +245,7 @@
}
if (server->touch_interval < 30)
server->touch_interval = 30;
- curl_easy_setopt (server->curl, CURLOPT_USERAGENT, ICECAST_VERSION_STRING);
+ curl_easy_setopt (server->curl, CURLOPT_USERAGENT, server_version);
curl_easy_setopt (server->curl, CURLOPT_URL, server->url);
curl_easy_setopt (server->curl, CURLOPT_HEADERFUNCTION, handle_returned_header);
curl_easy_setopt (server->curl, CURLOPT_WRITEFUNCTION, handle_returned_data);
@@ -925,6 +928,8 @@
if (yp_thread)
thread_join (yp_thread);
curl_global_cleanup();
+ free ((char*)server_version);
+ server_version = NULL;
INFO0 ("YP thread down");
}
More information about the commits
mailing list