pjsip_configuration.c: Misc cleanups.
authorRichard Mudgett <rmudgett@digium.com>
Mon, 11 Jul 2016 15:21:35 +0000 (10:21 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 13 Jul 2016 20:12:18 +0000 (15:12 -0500)
* 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

res/res_pjsip/pjsip_configuration.c

index 4d3fb65..d399f0b 100644 (file)
@@ -146,7 +146,7 @@ static int persistent_endpoint_update_state(void *obj, void *arg, int flags)
        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 @@ static int persistent_endpoint_update_state(void *obj, void *arg, int flags)
         */
        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 @@ static int persistent_endpoint_update_state(void *obj, void *arg, int flags)
                        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;
 }
@@ -202,7 +202,7 @@ static void persistent_endpoint_contact_created_observer(const void *object)
 
        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);
@@ -216,7 +216,7 @@ static void persistent_endpoint_contact_deleted_observer(const void *object)
 
        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;
        }
@@ -256,7 +256,8 @@ static void persistent_endpoint_contact_status_observer(const void *object)
        }
 
        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);
 
@@ -267,19 +268,23 @@ static void persistent_endpoint_contact_status_observer(const void *object)
 
                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 */