Skip to content

Commit eb586ee

Browse files
ionutrazvanionitabogdan-iancu
authored andcommitted
fix async: context shall be destroyed only at the last async call
(cherry picked from commit 672cb13)
1 parent 12d27ab commit eb586ee

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modules/tm/async.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ int t_resume_async(int fd, void *param)
142142
/* no need for the context anymore */
143143
shm_free(ctx);
144144

145+
context_destroy(CONTEXT_GLOBAL, current_processing_ctx);
146+
pkg_free(current_processing_ctx);
147+
145148
restore:
146149
/* restore original environment */
147150
set_t(backup_t);
@@ -152,8 +155,6 @@ int t_resume_async(int fd, void *param)
152155
bind_address = backup_si;
153156

154157
free_faked_req( &faked_req, t);
155-
context_destroy(CONTEXT_GLOBAL, current_processing_ctx);
156-
pkg_free(current_processing_ctx);
157158
current_processing_ctx = NULL;
158159

159160
return 0;
@@ -176,7 +177,7 @@ int t_handle_async(struct sip_msg *msg, struct action* a , int resume_route)
176177
r = t_newtran( msg , 1 /*full uas clone*/ );
177178
if (r==0) {
178179
/* retransmission -> no follow up; we return a negative
179-
* code to indicate do_action that the top route is
180+
* code to indicate do_action that the top route is
180181
* is completed (there no resume route to follow) */
181182
return -1;
182183
} else if (r<0) {
@@ -220,7 +221,7 @@ int t_handle_async(struct sip_msg *msg, struct action* a , int resume_route)
220221
goto resume;
221222
}
222223

223-
/* do we have a reactor in this process, to handle this
224+
/* do we have a reactor in this process, to handle this
224225
asyn I/O ? */
225226
if ( 0/*reactor_exists()*/ ) {
226227
/* no reactor, so we directly call the resume function

0 commit comments

Comments
 (0)