Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
aff756a4
Commit
aff756a4
authored
Feb 26, 2004
by
Karl Heyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add per mount queue size and source timeout, which can override the
general settings. svn path=/trunk/icecast/; revision=5867
parent
b7fbcef1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
9 deletions
+37
-9
src/cfgfile.c
src/cfgfile.c
+14
-1
src/cfgfile.h
src/cfgfile.h
+2
-0
src/connection.c
src/connection.c
+5
-1
src/source.c
src/source.c
+14
-7
src/source.h
src/source.h
+2
-0
No files found.
src/cfgfile.c
View file @
aff756a4
...
...
@@ -556,6 +556,19 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
option
=
option
->
next
;
}
}
else
if
(
strcmp
(
node
->
name
,
"queue-size"
)
==
0
)
{
tmp
=
(
char
*
)
xmlNodeListGetString
(
doc
,
node
->
xmlChildrenNode
,
1
);
mount
->
queue_size_limit
=
atoi
(
tmp
);
if
(
tmp
)
xmlFree
(
tmp
);
}
else
if
(
strcmp
(
node
->
name
,
"source-timeout"
)
==
0
)
{
tmp
=
(
char
*
)
xmlNodeListGetString
(
doc
,
node
->
xmlChildrenNode
,
1
);
if
(
tmp
)
{
mount
->
source_timeout
=
atoi
(
tmp
);
xmlFree
(
tmp
);
}
}
}
while
((
node
=
node
->
next
));
}
...
...
@@ -566,7 +579,7 @@ static void _parse_relay(xmlDocPtr doc, xmlNodePtr node,
relay_server
*
relay
=
calloc
(
1
,
sizeof
(
relay_server
));
relay_server
*
current
=
configuration
->
relay
;
relay_server
*
last
=
NULL
;
while
(
current
)
{
last
=
current
;
current
=
current
->
next
;
...
...
src/cfgfile.h
View file @
aff756a4
...
...
@@ -54,6 +54,8 @@ typedef struct _mount_proxy {
clients from the fallback? */
int
no_mount
;
/* Do we permit direct requests of this mountpoint? (or only
indirect, through fallbacks) */
unsigned
queue_size_limit
;
unsigned
source_timeout
;
/* source timeout in seconds */
char
*
auth_type
;
/* Authentication type */
config_options_t
*
auth_options
;
/* Options for this type */
...
...
src/connection.c
View file @
aff756a4
...
...
@@ -461,7 +461,7 @@ int connection_complete_source (source_t *source)
}
else
{
WARN0
(
"No content-type header, falling back to backwards compatibility mode"
WARN0
(
"No content-type header, falling back to backwards compatibility mode
"
"for icecast 1.x relays. Assuming content is mp3."
);
format_type
=
FORMAT_TYPE_MP3
;
}
...
...
@@ -480,6 +480,10 @@ int connection_complete_source (source_t *source)
global
.
sources
++
;
global_unlock
();
/* set global settings first */
source
->
queue_size_limit
=
config
->
queue_size_limit
;
source
->
timeout
=
config
->
source_timeout
;
/* for relays, we don't yet have a client, however we do require one
* to retrieve the stream from. This is created here, quite late,
* because we can't use this client to return an error code/message,
...
...
src/source.c
View file @
aff756a4
...
...
@@ -351,7 +351,7 @@ void *source_main(void *arg)
source_t
*
fallback_source
;
char
buffer
[
4096
];
long
bytes
,
sbytes
;
int
ret
,
timeout
;
int
ret
;
client_t
*
client
;
avl_node
*
client_node
;
...
...
@@ -365,7 +365,6 @@ void *source_main(void *arg)
char
*
ai
;
#endif
long
queue_limit
;
ice_config_t
*
config
;
char
*
hostname
;
char
*
listenurl
;
...
...
@@ -374,8 +373,6 @@ void *source_main(void *arg)
config
=
config_get_config
();
queue_limit
=
config
->
queue_size_limit
;
timeout
=
config
->
source_timeout
;
hostname
=
strdup
(
config
->
hostname
);
port
=
config
->
port
;
...
...
@@ -544,13 +541,13 @@ void *source_main(void *arg)
while
(
refbuf
==
NULL
)
{
bytes
=
0
;
while
(
bytes
<=
0
)
{
ret
=
util_timed_wait_for_fd
(
source
->
con
->
sock
,
timeout
*
1000
);
ret
=
util_timed_wait_for_fd
(
source
->
con
->
sock
,
source
->
timeout
*
1000
);
if
(
ret
<
0
&&
sock_recoverable
(
sock_error
()))
continue
;
if
(
ret
<=
0
)
{
/* timeout expired */
WARN1
(
"Disconnecting source: socket timeout (%d s) expired"
,
timeout
);
source
->
timeout
);
bytes
=
0
;
break
;
}
...
...
@@ -678,7 +675,7 @@ void *source_main(void *arg)
** we need to make sure the client is keeping up with the
** data, so we'll kick any client who's queue gets to large.
*/
if
(
refbuf_queue_length
(
&
client
->
queue
)
>
queu
e_limit
)
{
if
(
refbuf_queue_length
(
&
client
->
queue
)
>
source
->
queue_siz
e_limit
)
{
DEBUG0
(
"Client has fallen too far behind, removing"
);
client
->
con
->
error
=
1
;
}
...
...
@@ -900,6 +897,16 @@ void source_apply_mount (source_t *source, mount_proxy *mountinfo)
DEBUG1
(
"Dumping stream to %s"
,
mountinfo
->
dumpfile
);
source
->
dumpfilename
=
strdup
(
mountinfo
->
dumpfile
);
}
if
(
mountinfo
->
queue_size_limit
)
{
source
->
queue_size_limit
=
mountinfo
->
queue_size_limit
;
DEBUG1
(
"queue size to %u"
,
source
->
queue_size_limit
);
}
if
(
mountinfo
->
source_timeout
)
{
source
->
timeout
=
mountinfo
->
source_timeout
;
DEBUG1
(
"source timeout to %u"
,
source
->
timeout
);
}
}
...
...
src/source.h
View file @
aff756a4
...
...
@@ -56,6 +56,8 @@ typedef struct source_tag
struct
auth_tag
*
authenticator
;
int
fallback_override
;
int
no_mount
;
unsigned
queue_size_limit
;
unsigned
timeout
;
/* source timeout in seconds */
}
source_t
;
source_t
*
source_reserve
(
const
char
*
mount
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment