[asterisk-commits] rmudgett: trunk r410996 - in /trunk: ./ res/res_pjsip_registrar.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Mar 21 11:04:13 CDT 2014
Author: rmudgett
Date: Fri Mar 21 11:04:09 2014
New Revision: 410996
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=410996
Log:
res_pjsip_registrar.c: Miscellaneous cleanup in rx_task().
* Fix variable shadowing of 'updated' by renaming it to 'contact_update'.
* Checked 'contact_update' for ast_sorcery_copy() failure.
* Removed silly use of RAII_VAR() for 'contact_update'.
........
Merged revisions 410995 from http://svn.asterisk.org/svn/asterisk/branches/12
Modified:
trunk/ (props changed)
trunk/res/res_pjsip_registrar.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.
Modified: trunk/res/res_pjsip_registrar.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_registrar.c?view=diff&rev=410996&r1=410995&r2=410996
==============================================================================
--- trunk/res/res_pjsip_registrar.c (original)
+++ trunk/res/res_pjsip_registrar.c Fri Mar 21 11:04:09 2014
@@ -518,18 +518,26 @@
expiration,
user_agent);
} else if (expiration) {
- RAII_VAR(struct ast_sip_contact *, updated, ast_sorcery_copy(ast_sip_get_sorcery(), contact), ao2_cleanup);
- updated->expiration_time = ast_tvadd(ast_tvnow(), ast_samp2tv(expiration, 1));
- updated->qualify_frequency = task_data->aor->qualify_frequency;
- updated->authenticate_qualify = task_data->aor->authenticate_qualify;
+ struct ast_sip_contact *contact_update;
+
+ contact_update = ast_sorcery_copy(ast_sip_get_sorcery(), contact);
+ if (!contact_update) {
+ ast_log(LOG_ERROR, "Failed to update contact '%s' expiration time to %d seconds.\n",
+ contact->uri, expiration);
+ continue;
+ }
+
+ contact_update->expiration_time = ast_tvadd(ast_tvnow(), ast_samp2tv(expiration, 1));
+ contact_update->qualify_frequency = task_data->aor->qualify_frequency;
+ contact_update->authenticate_qualify = task_data->aor->authenticate_qualify;
if (path_str) {
- ast_string_field_set(updated, path, ast_str_buffer(path_str));
+ ast_string_field_set(contact_update, path, ast_str_buffer(path_str));
}
if (user_agent) {
- ast_string_field_set(updated, user_agent, user_agent);
+ ast_string_field_set(contact_update, user_agent, user_agent);
}
- ast_sip_location_update_contact(updated);
+ ast_sip_location_update_contact(contact_update);
ast_debug(3, "Refreshed contact '%s' on AOR '%s' with new expiration of %d seconds\n",
contact_uri, aor_name, expiration);
ast_test_suite_event_notify("AOR_CONTACT_REFRESHED",
@@ -540,7 +548,8 @@
contact_uri,
aor_name,
expiration,
- updated->user_agent);
+ contact_update->user_agent);
+ ao2_cleanup(contact_update);
} else {
/* We want to report the user agent that was actually in the removed contact */
user_agent = ast_strdupa(contact->user_agent);
More information about the asterisk-commits
mailing list