[xiph-commits] r9503 - icecast/branches/kh/icecast/src
karl at svn.xiph.org
karl at svn.xiph.org
Tue Jun 21 15:19:46 PDT 2005
Author: karl
Date: 2005-06-21 15:19:38 -0700 (Tue, 21 Jun 2005)
New Revision: 9503
Modified:
icecast/branches/kh/icecast/src/auth.c
icecast/branches/kh/icecast/src/auth.h
icecast/branches/kh/icecast/src/cfgfile.h
icecast/branches/kh/icecast/src/source.c
Log:
slight reduction in lock taking at stream start and end. make sure fallback
to file is marked hidden in stats.
Modified: icecast/branches/kh/icecast/src/auth.c
===================================================================
--- icecast/branches/kh/icecast/src/auth.c 2005-06-21 14:08:12 UTC (rev 9502)
+++ icecast/branches/kh/icecast/src/auth.c 2005-06-21 22:19:38 UTC (rev 9503)
@@ -483,12 +483,11 @@
}
-void auth_stream_start (const char *mount)
+/* called when the stream starts, so that authentication engine can do any
+ * cleanup/initialisation.
+ */
+void auth_stream_start (mount_proxy *mountinfo, const char *mount)
{
- mount_proxy *mountinfo;
- ice_config_t *config = config_get_config();
-
- mountinfo = config_find_mount (config, mount);
if (mountinfo && mountinfo->auth && mountinfo->auth->stream_start)
{
auth_client *auth_user = calloc (1, sizeof (auth_client));
@@ -500,15 +499,14 @@
queue_auth_client (auth_user);
}
}
- config_release_config ();
}
-void auth_stream_end (const char *mount)
-{
- mount_proxy *mountinfo;
- ice_config_t *config = config_get_config();
- mountinfo = config_find_mount (config, mount);
+/* Called when the stream ends so that the authentication engine can do
+ * any authentication cleanup
+ */
+void auth_stream_end (mount_proxy *mountinfo, const char *mount)
+{
if (mountinfo && mountinfo->auth && mountinfo->auth->stream_end)
{
auth_client *auth_user = calloc (1, sizeof (auth_client));
@@ -520,7 +518,6 @@
queue_auth_client (auth_user);
}
}
- config_release_config ();
}
Modified: icecast/branches/kh/icecast/src/auth.h
===================================================================
--- icecast/branches/kh/icecast/src/auth.h 2005-06-21 14:08:12 UTC (rev 9502)
+++ icecast/branches/kh/icecast/src/auth.h 2005-06-21 22:19:38 UTC (rev 9503)
@@ -81,10 +81,10 @@
void auth_release (auth_t *authenticator);
/* call to send a url request when source starts */
-void auth_stream_start (const char *mount);
+void auth_stream_start (struct _mount_proxy *mountinfo, const char *mount);
/* call to send a url request when source ends */
-void auth_stream_end (const char *mount);
+void auth_stream_end (struct _mount_proxy *mountinfo, const char *mount);
/* called from auth thread, after the client has successfully authenticated
* and requires adding to source or fserve. */
Modified: icecast/branches/kh/icecast/src/cfgfile.h
===================================================================
--- icecast/branches/kh/icecast/src/cfgfile.h 2005-06-21 14:08:12 UTC (rev 9502)
+++ icecast/branches/kh/icecast/src/cfgfile.h 2005-06-21 22:19:38 UTC (rev 9503)
@@ -20,6 +20,7 @@
#define MAX_YP_DIRECTORIES 25
+struct _mount_proxy;
#include "thread/thread.h"
#include "avl/avl.h"
Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c 2005-06-21 14:08:12 UTC (rev 9502)
+++ icecast/branches/kh/icecast/src/source.c 2005-06-21 22:19:38 UTC (rev 9503)
@@ -688,13 +688,15 @@
stats_event (source->mount, "audio_info", str);
}
- auth_stream_start (source->mount);
-
thread_mutex_unlock (&source->lock);
mountinfo = config_find_mount (config_get_config(), source->mount);
- if (mountinfo && mountinfo->on_connect)
- source_run_script (mountinfo->on_connect, source->mount);
+ if (mountinfo)
+ {
+ if (mountinfo->on_connect)
+ source_run_script (mountinfo->on_connect, source->mount);
+ auth_stream_start (mountinfo, source->mount);
+ }
config_release_config();
/*
@@ -777,10 +779,13 @@
INFO1("Source \"%s\" exiting", source->mount);
source->running = 0;
- auth_stream_end (source->mount);
mountinfo = config_find_mount (config_get_config(), source->mount);
- if (mountinfo && mountinfo->on_disconnect)
- source_run_script (mountinfo->on_disconnect, source->mount);
+ if (mountinfo)
+ {
+ if (mountinfo->on_disconnect)
+ source_run_script (mountinfo->on_disconnect, source->mount);
+ auth_stream_end (mountinfo, source->mount);
+ }
config_release_config();
/* we have de-activated the source now, so no more clients will be
@@ -1110,7 +1115,10 @@
{
/* skip if source is a fallback to file */
if (source->running && source->client->con == NULL)
+ {
+ stats_event_hidden (source->mount, NULL, 1);
return;
+ }
thread_mutex_lock (&source->lock);
/* set global settings first */
source->queue_size_limit = config->queue_size_limit;
More information about the commits
mailing list