diff -c -r icecast-2.2.0/doc/icecast2_config_file.html icecast-2.2.0-patched/doc/icecast2_config_file.html *** icecast-2.2.0/doc/icecast2_config_file.html Sat Dec 11 17:56:15 2004 --- icecast-2.2.0-patched/doc/icecast2_config_file.html Fri Mar 11 15:01:46 2005 *************** *** 42,47 **** --- 42,48 ---- <source-timeout>10</source-timeout> <burst-on-connect>1</burst-on-connect> <burst-size>65536</burst-size> + <client-maxtime>0</client-maxtime> </limits>
This section contains server level settings that, in general, do not need to be changed. Only modify this section if you are know what you are doing. *************** *** 85,90 **** --- 86,95 ---- is 64kbytes which is a typical size used by most clients so changing it is not usually required. This setting applies to all mountpoints. +
diff -c -r icecast-2.2.0/src/cfgfile.c icecast-2.2.0-patched/src/cfgfile.c
*** icecast-2.2.0/src/cfgfile.c Fri Dec 10 23:47:57 2004
--- icecast-2.2.0-patched/src/cfgfile.c Sun Jan 16 23:40:23 2005
***************
*** 34,39 ****
--- 34,40 ----
#define CONFIG_DEFAULT_QUEUE_SIZE_LIMIT (100*1024)
#define CONFIG_DEFAULT_THREADPOOL_SIZE 4
#define CONFIG_DEFAULT_CLIENT_TIMEOUT 30
+ #define CONFIG_DEFAULT_CLIENT_MAXTIME 0
#define CONFIG_DEFAULT_HEADER_TIMEOUT 15
#define CONFIG_DEFAULT_SOURCE_TIMEOUT 10
#define CONFIG_DEFAULT_SOURCE_PASSWORD "changeme"
***************
*** 319,324 ****
--- 320,326 ----
configuration->queue_size_limit = CONFIG_DEFAULT_QUEUE_SIZE_LIMIT;
configuration->threadpool_size = CONFIG_DEFAULT_THREADPOOL_SIZE;
configuration->client_timeout = CONFIG_DEFAULT_CLIENT_TIMEOUT;
+ configuration->client_maxtime = CONFIG_DEFAULT_CLIENT_MAXTIME;
configuration->header_timeout = CONFIG_DEFAULT_HEADER_TIMEOUT;
configuration->source_timeout = CONFIG_DEFAULT_SOURCE_TIMEOUT;
configuration->source_password = CONFIG_DEFAULT_SOURCE_PASSWORD;
***************
*** 471,476 ****
--- 473,482 ----
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->client_timeout = atoi(tmp);
if (tmp) xmlFree(tmp);
+ } else if (strcmp(node->name, "client-maxtime") == 0) {
+ tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+ configuration->client_maxtime = atoi(tmp);
+ if (tmp) xmlFree(tmp);
} else if (strcmp(node->name, "header-timeout") == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->header_timeout = atoi(tmp);
***************
*** 609,614 ****
--- 615,627 ----
mount->source_timeout = atoi (tmp);
xmlFree(tmp);
}
+ } else if (strcmp(node->name, "client-maxtime") == 0) {
+ tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+ if (tmp)
+ {
+ mount->client_maxtime = atoi (tmp);
+ xmlFree(tmp);
+ }
} else if (strcmp(node->name, "burst-size") == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->burst_size = atoi(tmp);
diff -c -r icecast-2.2.0/src/cfgfile.h icecast-2.2.0-patched/src/cfgfile.h
*** icecast-2.2.0/src/cfgfile.h Thu Dec 2 22:15:37 2004
--- icecast-2.2.0-patched/src/cfgfile.h Fri Mar 11 14:48:29 2005
***************
*** 60,65 ****
--- 60,66 ----
int no_yp; /* Do we prevent YP on this mount */
int hidden; /* Do we list this on the xsl pages */
unsigned int source_timeout; /* source timeout in seconds */
+ unsigned int client_maxtime; /* client maxtime in seconds */
char *auth_type; /* Authentication type */
char *cluster_password;
***************
*** 94,99 ****
--- 95,101 ----
int threadpool_size;
unsigned int burst_size;
int client_timeout;
+ unsigned int client_maxtime;
int header_timeout;
int source_timeout;
int ice_login;
diff -c -r icecast-2.2.0/src/connection.c icecast-2.2.0-patched/src/connection.c
*** icecast-2.2.0/src/connection.c Thu Dec 2 22:15:37 2004
--- icecast-2.2.0-patched/src/connection.c Fri Mar 11 14:59:32 2005
***************
*** 491,496 ****
--- 491,497 ----
/* set global settings first */
source->queue_size_limit = config->queue_size_limit;
source->timeout = config->source_timeout;
+ source->client_maxtime = config->client_maxtime;
source->burst_size = config->burst_size;
/* for relays, we don't yet have a client, however we do require one
diff -c -r icecast-2.2.0/src/source.c icecast-2.2.0-patched/src/source.c
*** icecast-2.2.0/src/source.c Tue Dec 7 23:25:12 2004
--- icecast-2.2.0-patched/src/source.c Fri Mar 11 15:36:27 2005
***************
*** 458,463 ****
--- 458,464 ----
int bytes;
int loop = 10; /* max number of iterations in one go */
int total_written = 0;
+ time_t current = time (NULL);
/* new users need somewhere to start from */
if (client->refbuf == NULL)
***************
*** 497,502 ****
--- 498,512 ----
DEBUG0("Client has fallen too far behind, removing");
client->con->error = 1;
}
+
+ if ((source->client_maxtime)&&
+ (client->con->con_time + (time_t)source->client_maxtime < current))
+ {
+ DEBUG3 ("start %ld, maxtime %ld, now %ld", client->con->con_time,
+ source->client_maxtime, current);
+ WARN0 ("Disconnecting client due to maxtime exceeding");
+ client->con->error = 1;
+ }
}
***************
*** 904,909 ****
--- 914,924 ----
source->timeout = mountinfo->source_timeout;
DEBUG1 ("source timeout to %u", source->timeout);
}
+ if (mountinfo->client_maxtime)
+ {
+ source->client_maxtime = mountinfo->client_maxtime;
+ DEBUG1 ("client maxtime to %u", source->client_maxtime);
+ }
if (mountinfo->no_yp)
{
source->yp_prevent = 1;
diff -c -r icecast-2.2.0/src/source.h icecast-2.2.0-patched/src/source.h
*** icecast-2.2.0/src/source.h Thu Dec 2 22:15:36 2004
--- icecast-2.2.0-patched/src/source.h Sun Jan 16 23:40:23 2005
***************
*** 66,71 ****
--- 66,72 ----
unsigned int queue_size_limit;
unsigned timeout; /* source timeout in seconds */
+ unsigned client_maxtime; /* client maxtime in seconds */
int hidden;
time_t last_read;
int short_delay;