| 288 | |
| 289 | |
| 290 | int check_and_alloc_branch(struct cell *t, unsigned short branch) |
| 291 | { |
| 292 | int i, b_chunk; |
| 293 | |
| 294 | /* do we have the branch chunk allocated? */ |
| 295 | b_chunk = branch / TM_BRANCH_CHUNK_SIZE; |
| 296 | if (t->uac[b_chunk]==NULL) { |
| 297 | t->uac[b_chunk] = |
| 298 | shm_malloc( TM_BRANCH_CHUNK_SIZE * sizeof(struct ua_client) ); |
| 299 | if (t->uac[b_chunk]==NULL) { |
| 300 | LM_ERR("failed to allocate a new chunk of branch, idx is %d\n", |
| 301 | branch); |
| 302 | return E_OUT_OF_MEM; |
| 303 | } |
| 304 | memset( t->uac[b_chunk], 0, |
| 305 | TM_BRANCH_CHUNK_SIZE * sizeof(struct ua_client) ); |
| 306 | /* the new chunk is in place, we are good to go */ |
| 307 | for ( i=branch; i<branch+TM_BRANCH_CHUNK_SIZE; i++) |
| 308 | init_branch( &TM_BRANCH(t,i), i, t->wait_tl.set, t); |
| 309 | } |
| 310 | return 0; |
| 311 | } |
| 312 | |
| 313 | |
| 314 |
no test coverage detected