| 225 | } |
| 226 | |
| 227 | static int mod_init(void) |
| 228 | { |
| 229 | if (cgre_retry_tout < 0) { |
| 230 | LM_ERR("Invalid retry connection timeout\n"); |
| 231 | return -1; |
| 232 | } |
| 233 | |
| 234 | if (cgrc_max_conns < 1) { |
| 235 | LM_WARN("Invalid number of maximum async connections: %d! " |
| 236 | "Async mode disabled!\n", cgrc_max_conns); |
| 237 | cgrc_max_conns = 0; |
| 238 | } |
| 239 | |
| 240 | /* load the TM API */ |
| 241 | if (load_tm_api(&cgr_tmb)!=0) { |
| 242 | LM_INFO("TM not loaded- cannot store variables in transaction!\n"); |
| 243 | } else { |
| 244 | cgr_tm_ctx_idx = cgr_tmb.t_ctx_register_ptr(cgr_free_ctx); |
| 245 | /* register a routine to move the pointer in tm when the transaction |
| 246 | * is created! */ |
| 247 | if (cgr_tmb.register_tmcb(0, 0, TMCB_REQUEST_IN, cgr_move_ctx, 0, 0)<=0) { |
| 248 | LM_ERR("cannot register tm callbacks\n"); |
| 249 | return -2; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | if (cgr_acc_init() < 0) |
| 254 | return -2; |
| 255 | |
| 256 | if (cgre_bind_ip.s) |
| 257 | cgre_bind_ip.len = strlen(cgre_bind_ip.s); |
| 258 | |
| 259 | cgr_ctx_idx = context_register_ptr(CONTEXT_GLOBAL, cgr_free_ctx); |
| 260 | cgr_ctx_local_idx = context_register_ptr(CONTEXT_GLOBAL, cgr_free_local_ctx); |
| 261 | |
| 262 | return 0; |
| 263 | } |
| 264 | |
| 265 | static int child_init(int rank) |
| 266 | { |
nothing calls this directly
no test coverage detected