Merge pull request #1175 in FS/freeswitch from ~ICEHESS/freeswitch:bugfix/FS-9989-mod_kazoo-provide-a-parameter-to to master
* commit '70503dd71e56acbb8a518c550f3b0945f007880e': FS-9989 [mod_kazoo] add a parameter to ignore transient network issues
This commit is contained in:
commit
a8620d8c92
|
@ -1281,6 +1281,7 @@ static void *SWITCH_THREAD_FUNC receive_handler(switch_thread_t *thread, void *o
|
||||||
static void *SWITCH_THREAD_FUNC handle_node(switch_thread_t *thread, void *obj) {
|
static void *SWITCH_THREAD_FUNC handle_node(switch_thread_t *thread, void *obj) {
|
||||||
ei_node_t *ei_node = (ei_node_t *) obj;
|
ei_node_t *ei_node = (ei_node_t *) obj;
|
||||||
ei_received_msg_t *received_msg = NULL;
|
ei_received_msg_t *received_msg = NULL;
|
||||||
|
int fault_count = 0;
|
||||||
|
|
||||||
switch_atomic_inc(&globals.threads);
|
switch_atomic_inc(&globals.threads);
|
||||||
|
|
||||||
|
@ -1332,13 +1333,17 @@ static void *SWITCH_THREAD_FUNC handle_node(switch_thread_t *thread, void *obj)
|
||||||
/* erlang nodes send ticks to eachother to validate they are still reachable, we dont have to do anything here */
|
/* erlang nodes send ticks to eachother to validate they are still reachable, we dont have to do anything here */
|
||||||
break;
|
break;
|
||||||
case ERL_MSG:
|
case ERL_MSG:
|
||||||
|
fault_count = 0;
|
||||||
|
|
||||||
if (switch_queue_trypush(ei_node->received_msgs, received_msg) != SWITCH_STATUS_SUCCESS) {
|
if (switch_queue_trypush(ei_node->received_msgs, received_msg) != SWITCH_STATUS_SUCCESS) {
|
||||||
ei_x_free(&received_msg->buf);
|
ei_x_free(&received_msg->buf);
|
||||||
switch_safe_free(received_msg);
|
switch_safe_free(received_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (globals.receive_msg_preallocate > 0 && received_msg->buf.buffsz > globals.receive_msg_preallocate) {
|
if (globals.receive_msg_preallocate > 0 && received_msg->buf.buffsz > globals.receive_msg_preallocate) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "increased received message buffer size to %d\n", received_msg->buf.buffsz);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "increased received message buffer size to %d\n", received_msg->buf.buffsz);
|
||||||
}
|
}
|
||||||
|
|
||||||
received_msg = NULL;
|
received_msg = NULL;
|
||||||
break;
|
break;
|
||||||
case ERL_ERROR:
|
case ERL_ERROR:
|
||||||
|
@ -1353,8 +1358,12 @@ static void *SWITCH_THREAD_FUNC handle_node(switch_thread_t *thread, void *obj)
|
||||||
switch_clear_flag(ei_node, LFLAG_RUNNING);
|
switch_clear_flag(ei_node, LFLAG_RUNNING);
|
||||||
break;
|
break;
|
||||||
case EIO:
|
case EIO:
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Erlang communication fault with node %p %s (%s:%d): socket closed or I/O error\n", (void *)ei_node, ei_node->peer_nodename, ei_node->remote_ip, ei_node->remote_port);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Erlang communication fault with node %p %s (%s:%d): socket closed or I/O error [fault count %d]\n", (void *)ei_node, ei_node->peer_nodename, ei_node->remote_ip, ei_node->remote_port, ++fault_count);
|
||||||
switch_clear_flag(ei_node, LFLAG_RUNNING);
|
|
||||||
|
if (fault_count >= globals.io_fault_tolerance) {
|
||||||
|
switch_clear_flag(ei_node, LFLAG_RUNNING);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* OH NOS! something has gone horribly wrong, shutdown the connection if status set by ei_xreceive_msg_tmo is less than or equal to 0 */
|
/* OH NOS! something has gone horribly wrong, shutdown the connection if status set by ei_xreceive_msg_tmo is less than or equal to 0 */
|
||||||
|
|
|
@ -349,6 +349,7 @@ static switch_status_t config(void) {
|
||||||
globals.send_msg_batch = 10;
|
globals.send_msg_batch = 10;
|
||||||
globals.event_stream_framing = 2;
|
globals.event_stream_framing = 2;
|
||||||
globals.port = 0;
|
globals.port = 0;
|
||||||
|
globals.io_fault_tolerance = 10;
|
||||||
|
|
||||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open configuration file %s\n", cf);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open configuration file %s\n", cf);
|
||||||
|
@ -410,6 +411,9 @@ static switch_status_t config(void) {
|
||||||
} else if (!strcmp(var, "event-stream-framing")) {
|
} else if (!strcmp(var, "event-stream-framing")) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set event-stream-framing: %s\n", val);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set event-stream-framing: %s\n", val);
|
||||||
globals.event_stream_framing = atoi(val);
|
globals.event_stream_framing = atoi(val);
|
||||||
|
} else if (!strcmp(var, "io-fault-tolerance")) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set io-fault-tolerance: %s\n", val);
|
||||||
|
globals.io_fault_tolerance = atoi(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,6 +448,11 @@ static switch_status_t config(void) {
|
||||||
globals.send_msg_batch = 10;
|
globals.send_msg_batch = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (globals.io_fault_tolerance < 1) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid I/O fault tolerance, reverting to default\n");
|
||||||
|
globals.io_fault_tolerance = 10;
|
||||||
|
}
|
||||||
|
|
||||||
if (!globals.event_filter) {
|
if (!globals.event_filter) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Event filter not found in configuration, using default\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Event filter not found in configuration, using default\n");
|
||||||
globals.event_filter = create_default_filter();
|
globals.event_filter = create_default_filter();
|
||||||
|
|
|
@ -119,6 +119,7 @@ struct globals_s {
|
||||||
short event_stream_framing;
|
short event_stream_framing;
|
||||||
switch_port_t port;
|
switch_port_t port;
|
||||||
int config_filters_fetched;
|
int config_filters_fetched;
|
||||||
|
int io_fault_tolerance;
|
||||||
};
|
};
|
||||||
typedef struct globals_s globals_t;
|
typedef struct globals_s globals_t;
|
||||||
extern globals_t globals;
|
extern globals_t globals;
|
||||||
|
|
Loading…
Reference in New Issue