[Freeswitch-svn] [commit] r9361 - in freeswitch/trunk/src: . mod/endpoints/mod_sofia mod/formats/mod_local_stream
Freeswitch SVN
anthm at freeswitch.org
Sat Aug 23 21:52:27 EDT 2008
Author: anthm
Date: Sat Aug 23 21:52:27 2008
New Revision: 9361
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
freeswitch/trunk/src/switch_loadable_module.c
Log:
tweak
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Sat Aug 23 21:52:27 2008
@@ -2226,8 +2226,8 @@
mod_sofia_globals.running = 1;
switch_mutex_unlock(mod_sofia_globals.mutex);
- switch_queue_create(&mod_sofia_globals.presence_queue, 500000, mod_sofia_globals.pool);
- switch_queue_create(&mod_sofia_globals.mwi_queue, 500000, mod_sofia_globals.pool);
+ switch_queue_create(&mod_sofia_globals.presence_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool);
+ switch_queue_create(&mod_sofia_globals.mwi_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool);
if (config_sofia(0, NULL) != SWITCH_STATUS_SUCCESS) {
mod_sofia_globals.running = 0;
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Sat Aug 23 21:52:27 2008
@@ -38,7 +38,7 @@
/*************************************************************************************************************************************************************/
#define IREG_SECONDS 30
#define GATEWAY_SECONDS 1
-
+#define SOFIA_QUEUE_SIZE 50000
#define HAVE_APR
#include <switch.h>
#include <switch_version.h>
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Sat Aug 23 21:52:27 2008
@@ -358,7 +358,6 @@
nua_handle_bind(nh, NULL);
}
sofia_private->destroy_me = 12;
-
free(sofia_private);
sofia_private = NULL;
}
@@ -443,7 +442,7 @@
sofia_set_pflag_locked(profile, PFLAG_WORKER_RUNNING);
- switch_queue_create(&profile->sql_queue, 500000, profile->pool);
+ switch_queue_create(&profile->sql_queue, SOFIA_QUEUE_SIZE, profile->pool);
qsize = switch_queue_size(profile->sql_queue);
Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c Sat Aug 23 21:52:27 2008
@@ -87,7 +87,8 @@
{
double r;
int index;
- srand(getpid() + ++S);
+ unsigned int seed = ++S + getpid();
+ srand(seed);
r = ((double) rand() / ((double) (RAND_MAX) + (double) (1)));
index = (int) (r * 9) + 1;
return index;
@@ -230,7 +231,7 @@
}
switch_core_timer_destroy(&timer);
- if (source->shuffle) {
+ if (RUNNING && source->shuffle) {
skip = do_rand();
}
}
@@ -472,6 +473,11 @@
switch_xml_free(xml);
}
+static void event_handler(switch_event_t *event)
+{
+ RUNNING = 0;
+}
+
SWITCH_MODULE_LOAD_FUNCTION(mod_local_stream_load)
{
switch_file_interface_t *file_interface;
@@ -485,6 +491,10 @@
file_interface->file_close = local_stream_file_close;
file_interface->file_read = local_stream_file_read;
+ if (switch_event_bind(modname, SWITCH_EVENT_SHUTDOWN, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event handler!\n");
+ }
+
memset(&globals, 0, sizeof(globals));
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, pool);
switch_core_hash_init(&globals.source_hash, pool);
Modified: freeswitch/trunk/src/switch_loadable_module.c
==============================================================================
--- freeswitch/trunk/src/switch_loadable_module.c (original)
+++ freeswitch/trunk/src/switch_loadable_module.c Sat Aug 23 21:52:27 2008
@@ -1149,6 +1149,8 @@
}
}
+ switch_yield(1000000);
+
for (hi = switch_hash_first(NULL, loadable_modules.module_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
module = (switch_loadable_module_t *) val;
More information about the Freeswitch-svn
mailing list