Skip to content
GitLab
Explore
Sign in
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
e3e24a08
Commit
e3e24a08
authored
6 years ago
by
George Joseph
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "stasis: No need to keep a stasis type ref in a stasis msg or cache object."
parents
a801543f
c99a9b22
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main/stasis_cache.c
+10
-2
10 additions, 2 deletions
main/stasis_cache.c
main/stasis_message.c
+8
-2
8 additions, 2 deletions
main/stasis_message.c
with
18 additions
and
4 deletions
main/stasis_cache.c
+
10
−
2
View file @
e3e24a08
...
...
@@ -156,7 +156,6 @@ static void cache_entry_dtor(void *obj)
struct
stasis_cache_entry
*
entry
=
obj
;
size_t
idx
;
ao2_cleanup
(
entry
->
key
.
type
);
entry
->
key
.
type
=
NULL
;
ast_free
((
char
*
)
entry
->
key
.
id
);
entry
->
key
.
id
=
NULL
;
...
...
@@ -204,7 +203,16 @@ static struct stasis_cache_entry *cache_entry_create(struct stasis_message_type
ao2_cleanup
(
entry
);
return
NULL
;
}
entry
->
key
.
type
=
ao2_bump
(
type
);
/*
* Normal ao2 ref counting rules says we should increment the message
* type ref here and decrement it in cache_entry_dtor(). However, the
* stasis message snapshot is cached here, will always have the same type
* as the cache entry, and can legitimately cause the type ref count to
* hit the excessive ref count assertion. Since the cache entry will
* always have a snapshot we can get away with not holding a ref here.
*/
ast_assert
(
type
==
stasis_message_type
(
snapshot
));
entry
->
key
.
type
=
type
;
cache_entry_compute_hash
(
&
entry
->
key
);
is_remote
=
ast_eid_cmp
(
&
ast_eid_default
,
stasis_message_eid
(
snapshot
))
?
1
:
0
;
...
...
This diff is collapsed.
Click to expand it.
main/stasis_message.c
+
8
−
2
View file @
e3e24a08
...
...
@@ -110,7 +110,6 @@ struct stasis_message {
static
void
stasis_message_dtor
(
void
*
obj
)
{
struct
stasis_message
*
message
=
obj
;
ao2_cleanup
(
message
->
type
);
ao2_cleanup
(
message
->
data
);
}
...
...
@@ -129,7 +128,14 @@ struct stasis_message *stasis_message_create_full(struct stasis_message_type *ty
}
message
->
timestamp
=
ast_tvnow
();
ao2_ref
(
type
,
+
1
);
/*
* XXX Normal ao2 ref counting rules says we should increment the message
* type ref here and decrement it in stasis_message_dtor(). However, the
* stasis message could be cached and legitimately cause the type ref count
* to hit the excessive ref count assertion. Since the message type
* practically has to be a global object anyway, we can get away with not
* holding a ref in the stasis message.
*/
message
->
type
=
type
;
ao2_ref
(
data
,
+
1
);
message
->
data
=
data
;
...
...
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