mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-27 12:56:15 +00:00
update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1264 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b81e4d6c97
commit
76b63d3a38
25
src/switch.c
25
src/switch.c
@ -107,6 +107,19 @@ int main(int argc, char *argv[])
|
|||||||
if (bg) {
|
if (bg) {
|
||||||
//snprintf(path, sizeof(path), "%s%c%s", SWITCH_GLOBAL_dirs.log_dir, sep, lfile);
|
//snprintf(path, sizeof(path), "%s%c%s", SWITCH_GLOBAL_dirs.log_dir, sep, lfile);
|
||||||
ppath = lfile;
|
ppath = lfile;
|
||||||
|
|
||||||
|
signal(SIGHUP, (void *) handle_SIGHUP);
|
||||||
|
signal(SIGTERM, (void *) handle_SIGHUP);
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
FreeConsole();
|
||||||
|
#else
|
||||||
|
if ((pid = fork())) {
|
||||||
|
fprintf(stderr, "%d Backgrounding.\n", (int)pid);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -132,19 +145,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (bg) {
|
|
||||||
signal(SIGHUP, (void *) handle_SIGHUP);
|
|
||||||
signal(SIGTERM, (void *) handle_SIGHUP);
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
FreeConsole();
|
|
||||||
#else
|
|
||||||
if ((pid = fork())) {
|
|
||||||
fprintf(stderr, "%d Backgrounding.\n", (int)pid);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(path, sizeof(path), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, pfile);
|
snprintf(path, sizeof(path), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, pfile);
|
||||||
if ((f = fopen(path, "w")) == 0) {
|
if ((f = fopen(path, "w")) == 0) {
|
||||||
|
@ -2361,9 +2361,9 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread *thread, vo
|
|||||||
switch_time_t last_commit = switch_time_now();
|
switch_time_t last_commit = switch_time_now();
|
||||||
uint32_t work = 0, freq = 1000, target = 500, diff = 0;
|
uint32_t work = 0, freq = 1000, target = 500, diff = 0;
|
||||||
|
|
||||||
if (!runtime.event_db) {
|
|
||||||
runtime.event_db = switch_core_db_handle();
|
runtime.event_db = switch_core_db_handle();
|
||||||
}
|
switch_queue_create(&runtime.sql_queue, SWITCH_SQL_QUEUE_LEN, runtime.memory_pool);
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if (switch_queue_trypop(runtime.sql_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
if (switch_queue_trypop(runtime.sql_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||||
@ -2565,18 +2565,15 @@ SWITCH_DECLARE(switch_status) switch_core_init(char *console)
|
|||||||
/* INIT APR and Create the pool context */
|
/* INIT APR and Create the pool context */
|
||||||
if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
|
if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
|
||||||
apr_terminate();
|
apr_terminate();
|
||||||
|
fprintf(stderr, "FATAL ERROR! Could not initilize APR\n");
|
||||||
return SWITCH_STATUS_MEMERR;
|
return SWITCH_STATUS_MEMERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (apr_pool_create(&runtime.memory_pool, NULL) != SWITCH_STATUS_SUCCESS) {
|
if (apr_pool_create(&runtime.memory_pool, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not allocate memory pool\n");
|
fprintf(stderr, "FATAL ERROR! Could not allocate memory pool\n");
|
||||||
switch_core_destroy();
|
switch_core_destroy();
|
||||||
return SWITCH_STATUS_MEMERR;
|
return SWITCH_STATUS_MEMERR;
|
||||||
}
|
}
|
||||||
assert(runtime.memory_pool != NULL);
|
|
||||||
switch_log_init(runtime.memory_pool);
|
|
||||||
switch_core_sql_thread_launch();
|
|
||||||
|
|
||||||
if(console) {
|
if(console) {
|
||||||
if (*console != '/') {
|
if (*console != '/') {
|
||||||
@ -2589,9 +2586,9 @@ SWITCH_DECLARE(switch_status) switch_core_init(char *console)
|
|||||||
runtime.console = stdout;
|
runtime.console = stdout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(runtime.memory_pool != NULL);
|
||||||
switch_queue_create(&runtime.sql_queue, SWITCH_SQL_QUEUE_LEN, runtime.memory_pool);
|
switch_log_init(runtime.memory_pool);
|
||||||
|
switch_core_sql_thread_launch();
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Allocated memory pool. Sessions are %u bytes\n", sizeof(struct switch_core_session));
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Allocated memory pool. Sessions are %u bytes\n", sizeof(struct switch_core_session));
|
||||||
switch_event_init(runtime.memory_pool);
|
switch_event_init(runtime.memory_pool);
|
||||||
|
@ -156,6 +156,7 @@ static void *SWITCH_THREAD_FUNC log_thread(switch_thread *thread, void *obj)
|
|||||||
free(node);
|
free(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
THREAD_RUNNING = 0;
|
THREAD_RUNNING = 0;
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Logger Ended.\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Logger Ended.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user