PROTON-1537: [proton-c] add useful information to pn_delivery_inspect
Old format: pn_delivery<ADDR>
New format: pn_delivery<ADDR>{send|receive, tag=b"TAG", local=STATE,
remote=STATE}
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/3649b60d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/3649b60d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/3649b60d
Branch: refs/heads/go1
Commit: 3649b60de9a5b8908386e7381ceb479498b90c4a
Parents: 1c1bfad
Author: Alan Conway <[email protected]>
Authored: Wed Dec 6 15:42:14 2017 -0500
Committer: Alan Conway <[email protected]>
Committed: Wed Dec 13 13:16:41 2017 -0500
----------------------------------------------------------------------
proton-c/src/core/engine.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3649b60d/proton-c/src/core/engine.c
----------------------------------------------------------------------
diff --git a/proton-c/src/core/engine.c b/proton-c/src/core/engine.c
index eae5ebf..0656dd9 100644
--- a/proton-c/src/core/engine.c
+++ b/proton-c/src/core/engine.c
@@ -1498,7 +1498,19 @@ static void pn_disposition_clear(pn_disposition_t *ds)
#define pn_delivery_initialize NULL
#define pn_delivery_hashcode NULL
#define pn_delivery_compare NULL
-#define pn_delivery_inspect NULL
+
+int pn_delivery_inspect(void *obj, pn_string_t *dst) {
+ pn_delivery_t *d = (pn_delivery_t*)obj;
+ const char* dir = pn_link_is_sender(d->link) ? "sending" : "receiving";
+ pn_bytes_t bytes = pn_buffer_bytes(d->tag);
+ int err =
+ pn_string_addf(dst, "pn_delivery<%p>{%s, tag=b\"", obj, dir) ||
+ pn_quote(dst, bytes.start, bytes.size) ||
+ pn_string_addf(dst, "\", local=%s, remote=%s}",
+ pn_disposition_type_name(d->local.type),
+ pn_disposition_type_name(d->remote.type));
+ return err;
+}
pn_delivery_tag_t pn_dtag(const char *bytes, size_t size) {
pn_delivery_tag_t dtag = {size, bytes};
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]