MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / check_and_alloc_branch

Function check_and_alloc_branch

modules/tm/t_fwd.c:290–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288
289
290int 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

Callers 4

t_uacFunction · 0.85
add_blind_uacFunction · 0.85
add_uacFunction · 0.85
add_phony_uacFunction · 0.85

Calls 2

shm_mallocFunction · 0.85
init_branchFunction · 0.85

Tested by

no test coverage detected