switch_event.patch
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- freeswitch-1.0.6/src/switch_event.c 2013-02-01 18:28:59.000000000 +0800
+++ freeswitch-1.0.6/src/switch_event.c 2013-02-01 18:28:59.000000000 +0800
@@ -35,7 +35,7 @@
#include <switch.h>
#include <switch_event.h>
-#define DISPATCH_QUEUE_LEN 5000
+#define DISPATCH_QUEUE_LEN 10000
//#define DEBUG_DISPATCH_QUEUES
/*! \brief A node to store binded events */
@@ -280,6 +280,7 @@
switch_queue_t *queue = (switch_queue_t *) obj;
uint32_t index = 0;
int my_id = 0;
+ int32_t ret=0;
switch_mutex_lock(EVENT_QUEUE_MUTEX);
THREAD_COUNT++;
@@ -311,10 +312,20 @@
while (event) {
for (index = 0; index < SOFT_MAX_DISPATCH; index++) {
- if (switch_queue_trypush(EVENT_DISPATCH_QUEUE[index], event) == SWITCH_STATUS_SUCCESS) {
+ if ((ret=switch_queue_trypush(EVENT_DISPATCH_QUEUE[index], event)) == SWITCH_STATUS_SUCCESS) {
event = NULL;
break;
}
+ else{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "push queue failed(err:%d,size:%d),try again\n"
+ ,ret,switch_queue_size(EVENT_DISPATCH_QUEUE[index]));
+
+ ret=switch_queue_push(EVENT_DISPATCH_QUEUE[index], event); //block to push
+ if(SWITCH_STATUS_SUCCESS == ret){
+ event=NULL;
+ break;
+ }
+ }
}
if (event) {