| 370 | } |
| 371 | |
| 372 | static int mod_init(void) |
| 373 | { |
| 374 | int heartbeats_timer_interval; |
| 375 | cluster_info_t *cl; |
| 376 | |
| 377 | LM_INFO("Clusterer module - initializing\n"); |
| 378 | |
| 379 | db_table.len = strlen(db_table.s); |
| 380 | db_bridges_table.len = strlen(db_bridges_table.s); |
| 381 | id_col.len = strlen(id_col.s); |
| 382 | cluster_id_col.len = strlen(cluster_id_col.s); |
| 383 | node_id_col.len = strlen(node_id_col.s); |
| 384 | url_col.len = strlen(url_col.s); |
| 385 | state_col.len = strlen(state_col.s); |
| 386 | no_ping_retries_col.len = strlen(no_ping_retries_col.s); |
| 387 | priority_col.len = strlen(priority_col.s); |
| 388 | sip_addr_col.len = strlen(sip_addr_col.s); |
| 389 | flags_col.len = strlen(flags_col.s); |
| 390 | description_col.len = strlen(description_col.s); |
| 391 | |
| 392 | /* only allow the DB URL to be skipped in "P2P discovery" mode */ |
| 393 | init_db_url(clusterer_db_url, db_mode == 0); |
| 394 | |
| 395 | if (current_id < 1) { |
| 396 | LM_CRIT("Invalid 'my_node_id' parameter\n"); |
| 397 | return -1; |
| 398 | } |
| 399 | if (ping_interval <= 0) { |
| 400 | LM_WARN("Invalid ping_interval parameter, using default value\n"); |
| 401 | ping_interval = DEFAULT_PING_INTERVAL; |
| 402 | } |
| 403 | if (node_timeout < 0) { |
| 404 | LM_WARN("Invalid node_timeout parameter, using default value\n"); |
| 405 | node_timeout = DEFAULT_NODE_TIMEOUT; |
| 406 | } |
| 407 | if (ping_timeout <= 0) { |
| 408 | LM_WARN("Invalid ping_timeout parameter, using default value\n"); |
| 409 | ping_timeout = DEFAULT_PING_TIMEOUT; |
| 410 | } |
| 411 | ping_timeout_us = ping_timeout * 1000; |
| 412 | ping_interval_us = ping_interval * 1000000; |
| 413 | |
| 414 | if (seed_fb_interval < 0) { |
| 415 | LM_WARN("Invalid seed_fallback_interval parameter, using default value\n"); |
| 416 | seed_fb_interval = DEFAULT_SEED_FB_INTERVAL; |
| 417 | } |
| 418 | |
| 419 | /* create & init lock */ |
| 420 | if ((cl_list_lock = lock_init_rw()) == NULL) { |
| 421 | LM_CRIT("Failed to init lock\n"); |
| 422 | return -1; |
| 423 | } |
| 424 | |
| 425 | /* if statistics are disabled, prevent their registration to core */ |
| 426 | if (clusterer_enable_stats==0) |
| 427 | exports.stats = 0; |
| 428 | |
| 429 | /* data pointer in shm */ |
nothing calls this directly
no test coverage detected