only kill event socket on 100 consecutive errors
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15671 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
d8c745a1bd
commit
c706e9bb3c
|
@ -2297,6 +2297,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime)
|
||||||
switch_socket_t *inbound_socket = NULL;
|
switch_socket_t *inbound_socket = NULL;
|
||||||
listener_t *listener;
|
listener_t *listener;
|
||||||
uint32_t x = 0;
|
uint32_t x = 0;
|
||||||
|
uint32_t errs = 0;
|
||||||
|
|
||||||
if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
|
||||||
|
@ -2342,15 +2343,23 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((rv = switch_socket_accept(&inbound_socket, listen_list.sock, listener_pool))) {
|
if ((rv = switch_socket_accept(&inbound_socket, listen_list.sock, listener_pool))) {
|
||||||
if (prefs.done) {
|
if (prefs.done) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n");
|
||||||
|
goto end;
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error\n");
|
/* I wish we could use strerror_r here but its not defined everywhere =/ */
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error [%s]\n", strerror(errno));
|
||||||
|
if (++errs > 100) {
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
} else {
|
||||||
|
errs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!(listener = switch_core_alloc(listener_pool, sizeof(*listener)))) {
|
if (!(listener = switch_core_alloc(listener_pool, sizeof(*listener)))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error\n");
|
||||||
break;
|
break;
|
||||||
|
@ -2376,6 +2385,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
|
||||||
close_socket(&listen_list.sock);
|
close_socket(&listen_list.sock);
|
||||||
|
|
||||||
if (prefs.nat_map && switch_core_get_variable("nat_type")) {
|
if (prefs.nat_map && switch_core_get_variable("nat_type")) {
|
||||||
|
|
Loading…
Reference in New Issue