Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Icecast-Server
Commits
6d969934
Commit
6d969934
authored
Feb 19, 2004
by
Karl Heyes
Browse files
Add checks for whether a source is active
svn path=/trunk/icecast/; revision=5843
parent
ebf6603c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/admin.c
View file @
6d969934
...
...
@@ -180,20 +180,21 @@ xmlDocPtr admin_build_sourcelist(char *current_source)
node
=
avl_get_first
(
global
.
source_tree
);
while
(
node
)
{
source
=
(
source_t
*
)
node
->
key
;
srcnode
=
xmlNewChild
(
xmlnode
,
NULL
,
"source"
,
NULL
);
xmlSetProp
(
srcnode
,
"mount"
,
source
->
mount
);
if
(
source
->
running
)
{
srcnode
=
xmlNewChild
(
xmlnode
,
NULL
,
"source"
,
NULL
);
xmlSetProp
(
srcnode
,
"mount"
,
source
->
mount
);
xmlNewChild
(
srcnode
,
NULL
,
"fallback"
,
xmlNewChild
(
srcnode
,
NULL
,
"fallback"
,
(
source
->
fallback_mount
!=
NULL
)
?
source
->
fallback_mount
:
""
);
memset
(
buf
,
'\000'
,
sizeof
(
buf
));
snprintf
(
buf
,
sizeof
(
buf
)
-
1
,
"%ld"
,
source
->
listeners
);
xmlNewChild
(
srcnode
,
NULL
,
"listeners"
,
buf
);
memset
(
buf
,
'\000'
,
sizeof
(
buf
));
snprintf
(
buf
,
sizeof
(
buf
)
-
1
,
"%ld"
,
now
-
source
->
con
->
con_time
);
xmlNewChild
(
srcnode
,
NULL
,
"Connected"
,
buf
);
xmlNewChild
(
srcnode
,
NULL
,
"Format"
,
source
->
format
->
format_description
);
snprintf
(
buf
,
sizeof
(
buf
),
"%ld"
,
source
->
listeners
);
xmlNewChild
(
srcnode
,
NULL
,
"listeners"
,
buf
);
snprintf
(
buf
,
sizeof
(
buf
),
"%ld"
,
now
-
source
->
con
->
con_time
);
xmlNewChild
(
srcnode
,
NULL
,
"Connected"
,
buf
);
xmlNewChild
(
srcnode
,
NULL
,
"Format"
,
source
->
format
->
format_description
);
}
node
=
avl_get_next
(
node
);
}
return
(
doc
);
...
...
@@ -288,6 +289,14 @@ void admin_handle_request(client_t *client, char *uri)
}
else
{
if
(
source
->
running
==
0
)
{
INFO2
(
"Received admin command %s on unavailable mount
\"
%s
\"
"
,
command_string
,
mount
);
avl_tree_unlock
(
global
.
source_tree
);
client_send_400
(
client
,
"Source is not available"
);
return
;
}
INFO2
(
"Received admin command %s on mount
\"
%s
\"
"
,
command_string
,
mount
);
admin_handle_mount_request
(
client
,
source
,
command
);
...
...
src/connection.c
View file @
6d969934
...
...
@@ -884,6 +884,13 @@ static void _handle_get_request(connection_t *con,
avl_tree_unlock
(
global
.
source_tree
);
return
;
}
if
(
source
->
running
==
0
)
{
avl_tree_unlock
(
global
.
source_tree
);
DEBUG0
(
"inactive source, client dropped"
);
client_send_404
(
client
,
"This mount is unavailable."
);
return
;
}
/* Check for any required authentication first */
if
(
source
->
authenticator
!=
NULL
)
{
...
...
src/yp.c
View file @
6d969934
...
...
@@ -160,6 +160,11 @@ int yp_touch()
node
=
avl_get_first
(
global
.
source_tree
);
while
(
node
)
{
source
=
(
source_t
*
)
node
->
key
;
if
(
source
->
running
==
0
)
{
node
=
avl_get_next
(
node
);
continue
;
}
current_time
=
time
(
NULL
);
if
(
!
source
->
yp_public
)
{
node
=
avl_get_next
(
node
);
...
...
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