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
a88cec63
Commit
a88cec63
authored
6 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_pjsip: Resolve transport management leak at shutdown."
parents
b400d50b
24302bda
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
res/res_pjsip/pjsip_transport_management.c
+27
-5
27 additions, 5 deletions
res/res_pjsip/pjsip_transport_management.c
with
27 additions
and
5 deletions
res/res_pjsip/pjsip_transport_management.c
+
27
−
5
View file @
a88cec63
...
...
@@ -119,10 +119,8 @@ static void *keepalive_transport_thread(void *data)
AST_THREADSTORAGE
(
desc_storage
);
static
int
idle_sched_
cb
(
const
void
*
data
)
static
int
idle_sched_
init_pj_thread
(
void
)
{
struct
monitored_transport
*
monitored
=
(
struct
monitored_transport
*
)
data
;
if
(
!
pj_thread_is_registered
())
{
pj_thread_t
*
thread
;
pj_thread_desc
*
desc
;
...
...
@@ -130,8 +128,7 @@ static int idle_sched_cb(const void *data)
desc
=
ast_threadstorage_get
(
&
desc_storage
,
sizeof
(
pj_thread_desc
));
if
(
!
desc
)
{
ast_log
(
LOG_ERROR
,
"Could not get thread desc from thread-local storage.
\n
"
);
ao2_ref
(
monitored
,
-
1
);
return
0
;
return
-
1
;
}
pj_bzero
(
*
desc
,
sizeof
(
*
desc
));
...
...
@@ -139,6 +136,18 @@ static int idle_sched_cb(const void *data)
pj_thread_register
(
"Transport Monitor"
,
*
desc
,
&
thread
);
}
return
0
;
}
static
int
idle_sched_cb
(
const
void
*
data
)
{
struct
monitored_transport
*
monitored
=
(
struct
monitored_transport
*
)
data
;
if
(
idle_sched_init_pj_thread
())
{
ao2_ref
(
monitored
,
-
1
);
return
0
;
}
if
(
!
monitored
->
sip_received
)
{
ast_log
(
LOG_NOTICE
,
"Shutting down transport '%s' since no request was received in %d seconds
\n
"
,
monitored
->
transport
->
info
,
IDLE_TIMEOUT
/
1000
);
...
...
@@ -149,6 +158,18 @@ static int idle_sched_cb(const void *data)
return
0
;
}
static
int
idle_sched_cleanup
(
const
void
*
data
)
{
struct
monitored_transport
*
monitored
=
(
struct
monitored_transport
*
)
data
;
if
(
!
idle_sched_init_pj_thread
())
{
pjsip_transport_shutdown
(
monitored
->
transport
);
}
ao2_ref
(
monitored
,
-
1
);
return
0
;
}
/*! \brief Destructor for keepalive transport */
static
void
monitored_transport_destroy
(
void
*
obj
)
{
...
...
@@ -384,6 +405,7 @@ void ast_sip_destroy_transport_management(void)
ast_sip_unregister_service
(
&
idle_monitor_module
);
ast_sched_clean_by_callback
(
sched
,
idle_sched_cb
,
idle_sched_cleanup
);
ast_sched_context_destroy
(
sched
);
sched
=
NULL
;
...
...
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