]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4186 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 4 May 2012 13:25:48 +0000 (08:25 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 4 May 2012 13:25:48 +0000 (08:25 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.h
src/switch_core.c
src/switch_event.c

index 64dfc48c8c7926f54013b6f82ff3319560c0dbcf..5a51f68a2d40cd6ffe59307237fe505988a86f2d 100644 (file)
@@ -337,7 +337,7 @@ typedef enum {
 } TFLAGS;
 
 #define SOFIA_MAX_MSG_QUEUE 64
-#define SOFIA_MSG_QUEUE_SIZE 100
+#define SOFIA_MSG_QUEUE_SIZE 250
 
 struct mod_sofia_globals {
        switch_memory_pool_t *pool;
index 8b93c84301656ced09163a11b9f9f92bbfcbc377..f957a7ae5ecf92193729ff352fed2584c6e51cba 100644 (file)
@@ -744,6 +744,8 @@ SWITCH_DECLARE(int32_t) set_auto_priority(void)
        runtime.cpu_count = sysinfo.dwNumberOfProcessors;
 #endif
 
+       if (!runtime.cpu_count) runtime.cpu_count = 1;
+
        /* If we have more than 1 cpu, we should use realtime priority so we can have priority threads */
        if (runtime.cpu_count > 1) {
                return set_realtime_priority();
@@ -1421,6 +1423,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
        }
 #endif 
 
+       if (!runtime.cpu_count) runtime.cpu_count = 1;
+
+
        /* INIT APR and Create the pool context */
        if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
                *err = "FATAL ERROR! Could not initialize APR\n";
index c4d118e3d2d913503fa29d0ffe773f89c2e0f096..bce57b79ee140f71c7ca22172528cbcde1c0b223 100644 (file)
@@ -35,7 +35,7 @@
 #include <switch.h>
 #include <switch_event.h>
 //#define SWITCH_EVENT_RECYCLE
-#define DISPATCH_QUEUE_LEN 10000
+#define DISPATCH_QUEUE_LEN 1000
 //#define DEBUG_DISPATCH_QUEUES
 
 /*! \brief A node to store binded events */
@@ -345,8 +345,9 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi
                                        launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, DISPATCH_QUEUE_LEN, RUNTIME_POOL);
                                        switch_mutex_unlock(EVENT_QUEUE_MUTEX);
                                } else {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Out of event dispatch threads! Resorting to a blocking push.... Look for laggy event consumers or event_socket connections!\n");
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Event Thread %d is blocking\n", my_id);
                                        switch_queue_push(EVENT_DISPATCH_QUEUE[0], event);
+                                       event = NULL;
                                }
                        }
                }
@@ -623,7 +624,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool)
         */
        
        /* don't need any more dispatch threads than we have CPU's*/
-       MAX_DISPATCH = switch_core_cpu_count();
+       MAX_DISPATCH = switch_core_cpu_count() + 1;
 
 
        switch_assert(pool != NULL);