[Asterisk-code-review] pjsip configuration.c: Misc cleanups. (asterisk[13])

Anonymous Coward asteriskteam at digium.com
Thu Jul 14 07:34:04 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: pjsip_configuration.c: Misc cleanups.
......................................................................


pjsip_configuration.c: Misc cleanups.

* Fix some whitespace in various routines.

* Rename i to iter in persistent_endpoint_update_state().

* Fix off-nominal copy/paste message wording in
persistent_endpoint_contact_deleted_observer()

Change-Id: Id8e34f5d09e7eebac3af22501c44c1110a3e29d8
---
M res/res_pjsip/pjsip_configuration.c
1 file changed, 17 insertions(+), 12 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index ec3851b..b445125 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -146,7 +146,7 @@
 	struct ast_endpoint *endpoint = persistent->endpoint;
 	struct ast_sip_contact_status *status = arg;
 	struct ao2_container *contacts;
-	struct ao2_iterator i;
+	struct ao2_iterator iter;
 	struct ast_sip_contact *contact;
 	enum ast_endpoint_state state = AST_ENDPOINT_OFFLINE;
 
@@ -162,8 +162,8 @@
 	 */
 	contacts = ast_sip_location_retrieve_contacts_from_aor_list(persistent->aors);
 	if (contacts) {
-		i = ao2_iterator_init(contacts, 0);
-		while (state == AST_ENDPOINT_OFFLINE && (contact = ao2_iterator_next(&i))) {
+		iter = ao2_iterator_init(contacts, 0);
+		while (state == AST_ENDPOINT_OFFLINE && (contact = ao2_iterator_next(&iter))) {
 			struct ast_sip_contact_status *contact_status;
 			const char *contact_id = ast_sorcery_object_get_id(contact);
 
@@ -176,11 +176,11 @@
 			ao2_cleanup(contact_status);
 			ao2_ref(contact, -1);
 		}
-		ao2_iterator_destroy(&i);
+		ao2_iterator_destroy(&iter);
 		ao2_ref(contacts, -1);
 	}
 
-	endpoint_update_state(endpoint,state);
+	endpoint_update_state(endpoint, state);
 
 	return 0;
 }
@@ -205,7 +205,7 @@
 	}
 	contact_status->status = CREATED;
 
-	ast_verb(2, "Contact %s/%s has been created\n",contact->aor, contact->uri);
+	ast_verb(2, "Contact %s/%s has been created\n", contact->aor, contact->uri);
 
 	ao2_callback(persistent_endpoints, OBJ_NODATA, persistent_endpoint_update_state, contact_status);
 	ao2_cleanup(contact_status);
@@ -219,7 +219,7 @@
 
 	contact_status = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), CONTACT_STATUS, ast_sorcery_object_get_id(contact));
 	if (!contact_status) {
-		ast_log(LOG_ERROR, "Unable to create ast_sip_contact_status for contact %s/%s\n",
+		ast_log(LOG_ERROR, "Unable to find ast_sip_contact_status for contact %s/%s\n",
 			contact->aor, contact->uri);
 		return;
 	}
@@ -259,7 +259,8 @@
 	}
 
 	if (contact_status->status != contact_status->last_status) {
-		ast_verb(3, "Contact %s/%s is now %s.  RTT: %.3f msec\n", contact_status->aor, contact_status->uri,
+		ast_verb(3, "Contact %s/%s is now %s.  RTT: %.3f msec\n",
+			contact_status->aor, contact_status->uri,
 			ast_sip_get_contact_status_label(contact_status->status),
 			contact_status->rtt / 1000.0);
 
@@ -270,19 +271,23 @@
 
 		ast_test_suite_event_notify("AOR_CONTACT_UPDATE",
 			"Contact: %s\r\n"
-				"Status: %s",
+			"Status: %s",
 			ast_sorcery_object_get_id(contact_status),
 			ast_sip_get_contact_status_label(contact_status->status));
 
-		ao2_callback(persistent_endpoints, OBJ_NODATA, persistent_endpoint_update_state, contact_status);
+		ao2_callback(persistent_endpoints, OBJ_NODATA, persistent_endpoint_update_state,
+			contact_status);
 	} else {
 		ast_debug(3, "Contact %s/%s status didn't change: %s, RTT: %.3f msec\n",
-			contact_status->aor, contact_status->uri, ast_sip_get_contact_status_label(contact_status->status),
+			contact_status->aor, contact_status->uri,
+			ast_sip_get_contact_status_label(contact_status->status),
 			contact_status->rtt / 1000.0);
 	}
 
 	ast_statsd_log_full_va("PJSIP.contacts.%s.rtt", AST_STATSD_TIMER,
-		contact_status->status != AVAILABLE ? -1 : contact_status->rtt / 1000, 1.0, ast_sorcery_object_get_id(contact_status));
+		contact_status->status != AVAILABLE ? -1 : contact_status->rtt / 1000,
+		1.0,
+		ast_sorcery_object_get_id(contact_status));
 }
 
 /*! \brief Observer for contacts so state can be updated on respective endpoints */

-- 
To view, visit https://gerrit.asterisk.org/3192
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id8e34f5d09e7eebac3af22501c44c1110a3e29d8
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list