-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add onreply_route async capabilities #3550
base: master
Are you sure you want to change the base?
Conversation
@vladpaiu , this sounds awesome !!! Let me check it ! |
if (async_status > 0) { | ||
/* async was started in the onreply route, no need to do anything more here */ | ||
/* mark that the UAC received replies */ | ||
uac->flags |= T_UAC_HAS_RECV_REPLY; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make any difference if we move the setting of the flag before running the onreply route, so we do not have to duplicate ?
@@ -319,8 +553,18 @@ int t_handle_async(struct sip_msg *msg, struct action* a, | |||
} | |||
|
|||
if (route_type!=REQUEST_ROUTE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some
if ()
else if ()
else
may look better here :)
/* DO TM suspended actions to decide if we need to relay */ | ||
LOCK_REPLIES( t ); | ||
|
||
/* we fire a cancel on spot if (a) branch is marked "to be canceled" or (b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this chunk below is duplicated from the reply_received()
(all the way to restore_exit_reply
label). I haven;t looked into details, but maybe we should avoid code duplicate, especially in such a delicate section, on reply handing. Maybe some refactoring into some new inline function ?
/* run the resume_route (some type as the original one) */ | ||
swap_route_type(route, ctx->route_type); | ||
/* do not run any post script callback, we are a reply */ | ||
run_resume_route( ctx->resume_route, ctx->reply, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial onreply route allows you to run with the lock (see the onreply_avp_mode
setting) or without lock. The resume route is not impacted (correct me if I'm wrong) by this setting, leading to concurrent access to the transactional list of AVPS.
set_cancelled_t(ctx->cancelled_t); | ||
set_e2eack_t(ctx->e2eack_t); | ||
reset_kr(); | ||
set_kr(ctx->kr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see this ctx->kr
set anywhere (in the new code). Do we need this? KR is typical for request processing, not for replies.
Similar the e2eack and cancel stuff.
Summary
Add onreply_route async capabilities
Solution
Clone reply before running async functions & free afterwards
Compatibility
Backwards incompatible, previous async in onreply_route was run in sync mode.