Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Icecast-Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
93
Issues
93
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
Icecast-Server
Commits
148af4e6
Commit
148af4e6
authored
Oct 22, 2007
by
Karl Heyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge work. mainly stats and some log message updates
svn path=/icecast/trunk/icecast/; revision=14031
parent
27f58c11
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
35 deletions
+40
-35
src/connection.c
src/connection.c
+13
-11
src/event.c
src/event.c
+1
-1
src/slave.c
src/slave.c
+11
-14
src/slave.h
src/slave.h
+1
-1
src/source.c
src/source.c
+14
-8
No files found.
src/connection.c
View file @
148af4e6
...
...
@@ -161,10 +161,9 @@ static unsigned long _next_connection_id(void)
#ifdef HAVE_OPENSSL
static
void
get_ssl_certificate
()
static
void
get_ssl_certificate
(
ice_config_t
*
config
)
{
SSL_METHOD
*
method
;
ice_config_t
*
config
;
ssl_ok
=
0
;
SSL_load_error_strings
();
/* readable error messages */
...
...
@@ -173,7 +172,6 @@ static void get_ssl_certificate ()
method
=
SSLv23_server_method
();
ssl_ctx
=
SSL_CTX_new
(
method
);
config
=
config_get_config
();
do
{
if
(
config
->
cert_file
==
NULL
)
...
...
@@ -190,16 +188,14 @@ static void get_ssl_certificate ()
}
if
(
!
SSL_CTX_check_private_key
(
ssl_ctx
))
{
ERROR0
(
"Invalid icecast.pem - Private key doesn't"
" match cert public key"
);
ERROR1
(
"Invalid %s - Private key does not match cert public key"
,
config
->
cert_file
);
break
;
}
ssl_ok
=
1
;
INFO1
(
"SSL certificate found at %s"
,
config
->
cert_file
);
return
;
}
while
(
0
);
config_release_config
();
if
(
ssl_ok
==
0
)
INFO0
(
"No SSL capability on any configured ports"
);
INFO0
(
"No SSL capability on any configured ports"
);
}
...
...
@@ -244,7 +240,7 @@ static int connection_send_ssl (connection_t *con, const void *buf, size_t len)
#else
/* SSL not compiled in, so at least log it */
static
void
get_ssl_certificate
()
static
void
get_ssl_certificate
(
ice_config_t
*
config
)
{
ssl_ok
=
0
;
INFO0
(
"No SSL capability"
);
...
...
@@ -313,7 +309,7 @@ void connection_uses_ssl (connection_t *con)
static
int
wait_for_serversock
(
int
timeout
)
{
#ifdef HAVE_POLL
struct
pollfd
ufds
[
MAX_LISTEN_SOCKETS
];
struct
pollfd
ufds
[
global
.
server_sockets
];
int
i
,
ret
;
for
(
i
=
0
;
i
<
global
.
server_sockets
;
i
++
)
{
...
...
@@ -580,8 +576,12 @@ static void _add_request_queue (client_queue_t *node)
void
connection_accept_loop
(
void
)
{
connection_t
*
con
;
ice_config_t
*
config
;
config
=
config_get_config
();
get_ssl_certificate
(
config
);
config_release_config
();
get_ssl_certificate
();
tid
=
thread_create
(
"connection thread"
,
_handle_connection
,
NULL
,
THREAD_ATTACHED
);
while
(
global
.
running
==
ICE_RUNNING
)
...
...
@@ -600,6 +600,8 @@ void connection_accept_loop(void)
{
global_unlock
();
client_send_403
(
client
,
"Icecast connection limit reached"
);
/* don't be too eager as this is an imposed hard limit */
thread_sleep
(
400000
);
continue
;
}
global_unlock
();
...
...
src/event.c
View file @
148af4e6
...
...
@@ -67,7 +67,7 @@ void event_config_read(void *arg)
fserve_recheck_mime_types
(
config
);
stats_global
(
config
);
config_release_config
();
slave_
recheck_all
();
slave_
update_all_mounts
();
}
}
src/slave.c
View file @
148af4e6
...
...
@@ -64,7 +64,7 @@ static void *_slave_thread(void *arg);
static
thread_type
*
_slave_thread_id
;
static
int
slave_running
=
0
;
static
volatile
int
update_settings
=
0
;
static
volatile
int
update_
stream
s
=
0
;
static
volatile
int
update_
all_mount
s
=
0
;
static
volatile
unsigned
int
max_interval
=
0
;
relay_server
*
relay_free
(
relay_server
*
relay
)
...
...
@@ -107,12 +107,12 @@ relay_server *relay_copy (relay_server *r)
/* force a recheck of the relays. This will recheck the master server if
*
a this is a slave.
*
this is a slave and rebuild all mountpoints in the stats tree
*/
void
slave_
recheck_all
(
void
)
void
slave_
update_all_mounts
(
void
)
{
max_interval
=
0
;
update_
stream
s
=
1
;
update_
all_mount
s
=
1
;
update_settings
=
1
;
}
...
...
@@ -342,6 +342,7 @@ static void *start_relay_stream (void *arg)
yp_remove
(
relay
->
localmount
);
relay
->
source
->
yp_public
=
-
1
;
relay
->
start
=
time
(
NULL
)
+
10
;
/* prevent busy looping if failing */
slave_update_all_mounts
();
}
/* we've finished, now get cleaned up */
...
...
@@ -390,14 +391,9 @@ static void check_relay_stream (relay_server *relay)
relay
->
source
=
source_reserve
(
relay
->
localmount
);
if
(
relay
->
source
)
{
ice_config_t
*
config
;
DEBUG1
(
"Adding relay source at mountpoint
\"
%s
\"
"
,
relay
->
localmount
);
config
=
config_get_config
();
stats_event_args
(
relay
->
localmount
,
"listenurl"
,
"http://%s:%d%s"
,
config
->
hostname
,
config
->
port
,
relay
->
localmount
);
config_release_config
();
stats_event
(
relay
->
localmount
,
"listeners"
,
"0"
);
slave_rebuild_mounts
();
if
(
relay
->
on_demand
)
slave_update_all_mounts
();
}
else
WARN1
(
"new relay but source
\"
%s
\"
already exists"
,
relay
->
localmount
);
...
...
@@ -408,6 +404,7 @@ static void check_relay_stream (relay_server *relay)
/* skip relay if active, not configured or just not time yet */
if
(
relay
->
source
==
NULL
||
relay
->
running
||
relay
->
start
>
time
(
NULL
))
break
;
/* check if an inactive on-demand relay has a fallback that has listeners */
if
(
relay
->
on_demand
&&
source
->
on_demand_req
==
0
)
{
relay
->
source
->
on_demand
=
relay
->
on_demand
;
...
...
@@ -685,7 +682,7 @@ static void *_slave_thread(void *arg)
unsigned
int
interval
=
0
;
update_settings
=
0
;
update_
stream
s
=
0
;
update_
all_mount
s
=
0
;
config
=
config_get_config
();
stats_global
(
config
);
...
...
@@ -740,9 +737,9 @@ static void *_slave_thread(void *arg)
if
(
update_settings
)
{
source_recheck_mounts
(
update_
stream
s
);
source_recheck_mounts
(
update_
all_mount
s
);
update_settings
=
0
;
update_
stream
s
=
0
;
update_
all_mount
s
=
0
;
}
}
INFO0
(
"shutting down current relays"
);
...
...
src/slave.h
View file @
148af4e6
...
...
@@ -35,7 +35,7 @@ typedef struct _relay_server {
void
slave_initialize
(
void
);
void
slave_shutdown
(
void
);
void
slave_
recheck_all
(
void
);
void
slave_
update_all_mounts
(
void
);
void
slave_rebuild_mounts
(
void
);
relay_server
*
relay_free
(
relay_server
*
relay
);
...
...
src/source.c
View file @
148af4e6
...
...
@@ -1164,6 +1164,9 @@ void source_update_settings (ice_config_t *config, source_t *source, mount_proxy
source
->
timeout
=
config
->
source_timeout
;
source
->
burst_size
=
config
->
burst_size
;
stats_event_args
(
source
->
mount
,
"listenurl"
,
"http://%s:%d%s"
,
config
->
hostname
,
config
->
port
,
source
->
mount
);
source_apply_mount
(
source
,
mountinfo
);
if
(
source
->
fallback_mount
)
...
...
@@ -1180,6 +1183,7 @@ void source_update_settings (ice_config_t *config, source_t *source, mount_proxy
{
DEBUG0
(
"on_demand set"
);
stats_event
(
source
->
mount
,
"on_demand"
,
"1"
);
stats_event_args
(
source
->
mount
,
"listeners"
,
"%ld"
,
source
->
listeners
);
}
else
stats_event
(
source
->
mount
,
"on_demand"
,
NULL
);
...
...
@@ -1187,7 +1191,7 @@ void source_update_settings (ice_config_t *config, source_t *source, mount_proxy
if
(
source
->
hidden
)
{
stats_event_hidden
(
source
->
mount
,
NULL
,
1
);
DEBUG0
(
"hidden from
xsl
"
);
DEBUG0
(
"hidden from
public
"
);
}
else
stats_event_hidden
(
source
->
mount
,
NULL
,
0
);
...
...
@@ -1316,7 +1320,7 @@ static void *source_fallback_file (void *arg)
file
=
fopen
(
path
,
"rb"
);
if
(
file
==
NULL
)
{
DEBUG
1
(
"unable to open file
\"
%s
\"
"
,
path
);
WARN
1
(
"unable to open file
\"
%s
\"
"
,
path
);
free
(
path
);
break
;
}
...
...
@@ -1324,9 +1328,10 @@ static void *source_fallback_file (void *arg)
source
=
source_reserve
(
mount
);
if
(
source
==
NULL
)
{
DEBUG
1
(
"mountpoint
\"
%s
\"
already reserved"
,
mount
);
WARN
1
(
"mountpoint
\"
%s
\"
already reserved"
,
mount
);
break
;
}
INFO1
(
"mountpoint %s is reserved"
,
mount
);
type
=
fserve_content_type
(
mount
);
parser
=
httpp_create_parser
();
httpp_initialize
(
parser
,
NULL
);
...
...
@@ -1361,7 +1366,8 @@ void source_recheck_mounts (int update_all)
avl_tree_rlock
(
global
.
source_tree
);
stats_clear_virtual_mounts
();
if
(
update_all
)
stats_clear_virtual_mounts
();
while
(
mount
)
{
...
...
@@ -1370,16 +1376,16 @@ void source_recheck_mounts (int update_all)
if
(
source
)
{
source
=
source_find_mount_raw
(
mount
->
mountname
);
stats_event_args
(
mount
->
mountname
,
"listenurl"
,
"http://%s:%d%s"
,
config
->
hostname
,
config
->
port
,
mount
->
mountname
);
if
(
source
&&
update_all
)
if
(
source
)
{
mount_proxy
*
mountinfo
=
config_find_mount
(
config
,
source
->
mount
);
source_update_settings
(
config
,
source
,
mountinfo
);
}
else
else
if
(
update_all
)
{
stats_event_hidden
(
mount
->
mountname
,
NULL
,
mount
->
hidden
);
stats_event_args
(
mount
->
mountname
,
"listenurl"
,
"http://%s:%d%s"
,
config
->
hostname
,
config
->
port
,
mount
->
mountname
);
stats_event
(
mount
->
mountname
,
"listeners"
,
"0"
);
if
(
mount
->
max_listeners
<
0
)
stats_event
(
mount
->
mountname
,
"max_listeners"
,
"unlimited"
);
...
...
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