This is an automated email from the ASF dual-hosted git repository.
gmurthy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/main by this push:
new 5804a70 DISPATCH-2247: Added router id to log message
5804a70 is described below
commit 5804a70ca22d4300f5c43c4bdd9cac7eeff0d27a
Author: Ganesh Murthy <[email protected]>
AuthorDate: Mon Nov 1 10:06:55 2021 -0400
DISPATCH-2247: Added router id to log message
---
src/router_core/modules/mobile_sync/mobile.c | 30 ++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/router_core/modules/mobile_sync/mobile.c
b/src/router_core/modules/mobile_sync/mobile.c
index 866e17a..8a9816d 100644
--- a/src/router_core/modules/mobile_sync/mobile.c
+++ b/src/router_core/modules/mobile_sync/mobile.c
@@ -75,6 +75,26 @@ typedef struct {
qdr_address_list_t deleted_addrs;
} qdrm_mobile_sync_t;
+/**
+ * Gets the router id from the parsed field and prints the relevant error
message.
+ */
+static void print_error_log(qdrm_mobile_sync_t *msync, qd_parsed_field_t
*id_field, bool mau)
+{
+ char *r_id = 0;
+ if (id_field) {
+ qd_iterator_t *id_iter = qd_parse_raw(id_field);
+ if (id_iter) {
+ r_id = (char *)qd_iterator_copy(id_iter);
+ }
+ }
+ //
+ // There is a possibility here that router_id is null but that is fine. We
want to print it out either way
+ // which will help us in debugging.
+ //
+ qd_log(msync->log, QD_LOG_ERROR, "Received %s from an unknown router with
router id %s", mau? "MAU": "MAR", r_id);
+ free(r_id);
+}
+
static void qcm_mobile_sync_on_router_advanced_CT(qdrm_mobile_sync_t *msync,
qdr_node_t *router);
//================================================================================
@@ -457,8 +477,9 @@ static void qcm_mobile_sync_on_mar_CT(qdrm_mobile_sync_t
*msync, qd_parsed_field
//
qd_log(msync->log, QD_LOG_DEBUG, "Sent MAU to requestor:
mobile_seq=%"PRIu64, msync->mobile_seq);
}
- } else
- qd_log(msync->log, QD_LOG_ERROR, "Received MAR from an unknown
router");
+ } else {
+ print_error_log(msync, id_field, false);
+ }
}
}
@@ -690,8 +711,9 @@ static void qcm_mobile_sync_on_mau_CT(qdrm_mobile_sync_t
*msync, qd_parsed_field
// Tell the python router about the new mobile sequence
//
qdr_post_set_mobile_seq_CT(msync->core, router->mask_bit,
mobile_seq);
- } else
- qd_log(msync->log, QD_LOG_ERROR, "Received MAU from an unknown
router");
+ } else {
+ print_error_log(msync, id_field, true);
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]