Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Startup/Shutdown
[Core Library]


Functions

switch_status_t switch_core_init (_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err)
 Initilize the core.
switch_status_t switch_core_init_and_modload (_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err)
 Initilize the core and load modules.
uint32_t switch_core_session_limit (_In_ uint32_t new_limit)
 Set/Get Session Limit.
uint32_t switch_core_sessions_per_second (_In_ uint32_t new_limit)
 Set/Get Session Rate Limit.
switch_status_t switch_core_destroy (void)
 Destroy the core.


Function Documentation

switch_status_t switch_core_destroy void   ) 
 

Destroy the core.

Note:
to be called at application shutdown
01408 {
01409         switch_event_t *event;
01410         if (switch_event_create(&event, SWITCH_EVENT_SHUTDOWN) == SWITCH_STATUS_SUCCESS) {
01411                 switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Info", "System Shutting Down");
01412                 switch_event_fire(&event);
01413         }
01414 
01415         switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
01416         switch_set_flag((&runtime), SCF_SHUTTING_DOWN);
01417 
01418         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "End existing sessions\n");
01419         switch_core_session_hupall(SWITCH_CAUSE_SYSTEM_SHUTDOWN);
01420         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n");
01421         switch_core_memory_stop();
01422         switch_loadable_module_shutdown();
01423 
01424         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Closing Event Engine.\n");
01425         switch_event_shutdown();
01426 
01427         if (switch_test_flag((&runtime), SCF_USE_SQL)) {
01428                 switch_core_sqldb_stop();
01429         }
01430         switch_scheduler_task_thread_stop();
01431 
01432         switch_rtp_shutdown();
01433         switch_xml_destroy();
01434         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n");
01435         switch_log_shutdown();
01436 
01437         if (runtime.console && runtime.console != stdout && runtime.console != stderr) {
01438                 fclose(runtime.console);
01439                 runtime.console = NULL;
01440         }
01441 
01442         switch_safe_free(SWITCH_GLOBAL_dirs.base_dir);
01443         switch_safe_free(SWITCH_GLOBAL_dirs.mod_dir);
01444         switch_safe_free(SWITCH_GLOBAL_dirs.conf_dir);
01445         switch_safe_free(SWITCH_GLOBAL_dirs.log_dir);
01446         switch_safe_free(SWITCH_GLOBAL_dirs.db_dir);
01447         switch_safe_free(SWITCH_GLOBAL_dirs.script_dir);
01448         switch_safe_free(SWITCH_GLOBAL_dirs.htdocs_dir);
01449         switch_safe_free(SWITCH_GLOBAL_dirs.grammar_dir);
01450         switch_safe_free(SWITCH_GLOBAL_dirs.temp_dir);
01451 
01452         switch_core_hash_destroy(&runtime.global_vars);
01453         switch_core_hash_destroy(&runtime.mime_types);
01454 
01455         if (runtime.memory_pool) {
01456                 apr_pool_destroy(runtime.memory_pool);
01457                 if (switch_test_flag((&runtime), SCF_RESTART)) {
01458                         apr_terminate();
01459                 }
01460         }
01461         
01462         return switch_test_flag((&runtime), SCF_RESTART) ? SWITCH_STATUS_RESTART : SWITCH_STATUS_SUCCESS;
01463 }

Here is the call graph for this function:

switch_status_t switch_core_init _In_ switch_core_flag_t  flags,
_In_ switch_bool_t  console,
_Out_ const char **  err
 

Initilize the core.

Parameters:
console optional FILE stream for output
flags core flags
err a pointer to set any errors to
Note:
to be called at application startup

switch_status_t switch_core_init_and_modload _In_ switch_core_flag_t  flags,
_In_ switch_bool_t  console,
_Out_ const char **  err
 

Initilize the core and load modules.

Parameters:
console optional FILE stream for output
flags core flags
err a pointer to set any errors to
Note:
to be called at application startup instead of switch_core_init. Includes module loading.

uint32_t switch_core_session_limit _In_ uint32_t  new_limit  ) 
 

Set/Get Session Limit.

Parameters:
new_limit new value (if > 0)
Returns:
the current session limit

uint32_t switch_core_sessions_per_second _In_ uint32_t  new_limit  ) 
 

Set/Get Session Rate Limit.

Parameters:
new_limit new value (if > 0)
Returns:
the current session rate limit


Generated on Fri Oct 10 11:24:32 2008 for FreeSWITCH by  doxygen 1.3.9.1