mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 11:11:05 +00:00
res_pjsip: Create human friendly serializer names.
PJSIP name formats: pjsip/aor/<aor>-<seq> -- registrar thread pool serializer pjsip/default-<seq> -- default thread pool serializer pjsip/messaging -- messaging thread pool serializer pjsip/outreg/<registration>-<seq> -- outbound registration thread pool serializer pjsip/pubsub/<endpoint>-<seq> -- pubsub thread pool serializer pjsip/refer/<endpoint>-<seq> -- REFER thread pool serializer pjsip/session/<endpoint>-<seq> -- session thread pool serializer pjsip/websocket-<seq> -- websocket thread pool serializer Change-Id: Iff9df8da3ddae1132cb2ef65f64df0c465c5e084
This commit is contained in:
@@ -3379,23 +3379,34 @@ int ast_sip_append_body(pjsip_tx_data *tdata, const char *body_text)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ast_taskprocessor *ast_sip_create_serializer_group_named(const char *name, struct ast_serializer_shutdown_group *shutdown_group)
|
||||
{
|
||||
return ast_threadpool_serializer_group(name, sip_threadpool, shutdown_group);
|
||||
}
|
||||
|
||||
struct ast_taskprocessor *ast_sip_create_serializer_group(struct ast_serializer_shutdown_group *shutdown_group)
|
||||
{
|
||||
struct ast_taskprocessor *serializer;
|
||||
char name[AST_UUID_STR_LEN];
|
||||
char tps_name[AST_TASKPROCESSOR_MAX_NAME + 1];
|
||||
|
||||
ast_uuid_generate_str(name, sizeof(name));
|
||||
/* Create name with seq number appended. */
|
||||
ast_taskprocessor_build_name(tps_name, sizeof(tps_name), "pjsip-group-serializer");
|
||||
|
||||
serializer = ast_threadpool_serializer_group(name, sip_threadpool, shutdown_group);
|
||||
if (!serializer) {
|
||||
return NULL;
|
||||
}
|
||||
return serializer;
|
||||
return ast_sip_create_serializer_group_named(tps_name, shutdown_group);
|
||||
}
|
||||
|
||||
struct ast_taskprocessor *ast_sip_create_serializer_named(const char *name)
|
||||
{
|
||||
return ast_sip_create_serializer_group_named(name, NULL);
|
||||
}
|
||||
|
||||
struct ast_taskprocessor *ast_sip_create_serializer(void)
|
||||
{
|
||||
return ast_sip_create_serializer_group(NULL);
|
||||
char tps_name[AST_TASKPROCESSOR_MAX_NAME + 1];
|
||||
|
||||
/* Create name with seq number appended. */
|
||||
ast_taskprocessor_build_name(tps_name, sizeof(tps_name), "pjsip-serializer");
|
||||
|
||||
return ast_sip_create_serializer_group_named(tps_name, NULL);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -3425,10 +3436,14 @@ static void serializer_pool_shutdown(void)
|
||||
*/
|
||||
static int serializer_pool_setup(void)
|
||||
{
|
||||
char tps_name[AST_TASKPROCESSOR_MAX_NAME + 1];
|
||||
int idx;
|
||||
|
||||
for (idx = 0; idx < SERIALIZER_POOL_SIZE; ++idx) {
|
||||
serializer_pool[idx] = ast_sip_create_serializer();
|
||||
/* Create name with seq number appended. */
|
||||
ast_taskprocessor_build_name(tps_name, sizeof(tps_name), "pjsip/default");
|
||||
|
||||
serializer_pool[idx] = ast_sip_create_serializer_named(tps_name);
|
||||
if (!serializer_pool[idx]) {
|
||||
serializer_pool_shutdown();
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user