Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
9ec08d75
Commit
9ec08d75
authored
6 years ago
by
George Joseph
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "stasis: Add function to delete topic from pool"
parents
ffcccd5e
d277db4a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/asterisk/stasis.h
+12
-0
12 additions, 0 deletions
include/asterisk/stasis.h
main/stasis.c
+36
-0
36 additions, 0 deletions
main/stasis.c
with
48 additions
and
0 deletions
include/asterisk/stasis.h
+
12
−
0
View file @
9ec08d75
...
...
@@ -752,6 +752,18 @@ struct stasis_topic_pool *stasis_topic_pool_create(struct stasis_topic *pooled_t
*/
struct
stasis_topic
*
stasis_topic_pool_get_topic
(
struct
stasis_topic_pool
*
pool
,
const
char
*
topic_name
);
/*!
* \brief Delete a topic from the topic pool
*
* \param pool Pool from which to delete the topic
* \param topic_name Name of the topic to delete
*
* \since 13.24
* \since 15.6
* \since 16.1
*/
void
stasis_topic_pool_delete_topic
(
struct
stasis_topic_pool
*
pool
,
const
char
*
topic_name
);
/*!
* \brief Check if a topic exists in a pool
* \param pool Pool to check
...
...
This diff is collapsed.
Click to expand it.
main/stasis.c
+
36
−
0
View file @
9ec08d75
...
...
@@ -1079,6 +1079,15 @@ static void topic_pool_dtor(void *obj)
{
struct
stasis_topic_pool
*
pool
=
obj
;
#ifdef AO2_DEBUG
{
char
*
container_name
=
ast_alloca
(
strlen
(
stasis_topic_name
(
pool
->
pool_topic
))
+
strlen
(
"-pool"
)
+
1
);
sprintf
(
container_name
,
"%s-pool"
,
stasis_topic_name
(
pool
->
pool_topic
));
ao2_container_unregister
(
container_name
);
}
#endif
ao2_cleanup
(
pool
->
pool_container
);
pool
->
pool_container
=
NULL
;
ao2_cleanup
(
pool
->
pool_topic
);
...
...
@@ -1143,6 +1152,18 @@ static int topic_pool_entry_cmp(void *obj, void *arg, int flags)
return
CMP_MATCH
;
}
#ifdef AO2_DEBUG
static
void
topic_pool_prnt_obj
(
void
*
v_obj
,
void
*
where
,
ao2_prnt_fn
*
prnt
)
{
struct
topic_pool_entry
*
entry
=
v_obj
;
if
(
!
entry
)
{
return
;
}
prnt
(
where
,
"%s"
,
stasis_topic_name
(
entry
->
topic
));
}
#endif
struct
stasis_topic_pool
*
stasis_topic_pool_create
(
struct
stasis_topic
*
pooled_topic
)
{
struct
stasis_topic_pool
*
pool
;
...
...
@@ -1158,12 +1179,27 @@ struct stasis_topic_pool *stasis_topic_pool_create(struct stasis_topic *pooled_t
ao2_cleanup
(
pool
);
return
NULL
;
}
#ifdef AO2_DEBUG
{
char
*
container_name
=
ast_alloca
(
strlen
(
stasis_topic_name
(
pooled_topic
))
+
strlen
(
"-pool"
)
+
1
);
sprintf
(
container_name
,
"%s-pool"
,
stasis_topic_name
(
pooled_topic
));
ao2_container_register
(
container_name
,
pool
->
pool_container
,
topic_pool_prnt_obj
);
}
#endif
ao2_ref
(
pooled_topic
,
+
1
);
pool
->
pool_topic
=
pooled_topic
;
return
pool
;
}
void
stasis_topic_pool_delete_topic
(
struct
stasis_topic_pool
*
pool
,
const
char
*
topic_name
)
{
ao2_find
(
pool
->
pool_container
,
topic_name
,
OBJ_SEARCH_KEY
|
OBJ_NODATA
|
OBJ_UNLINK
);
}
struct
stasis_topic
*
stasis_topic_pool_get_topic
(
struct
stasis_topic_pool
*
pool
,
const
char
*
topic_name
)
{
RAII_VAR
(
struct
topic_pool_entry
*
,
topic_pool_entry
,
NULL
,
ao2_cleanup
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment