You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2026/05/05 01:36:14 UTC

(qpid-proton) branch main updated (169e19a75 -> 490d64a25)

This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


    from 169e19a75 PROTON-2930: epoll proator repeated epoll_wait on disconnected socket
     new e1695bc5e PROTON-2873: Make it easier to switch between disposition types
     new 490d64a25 PROTON-2932: [C++] Allow proton::transfer to be hashed

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 c/include/proton/disposition.h  |  7 +++++++
 c/src/core/engine-internal.h    |  2 --
 cpp/include/proton/delivery.hpp |  7 +++++++
 cpp/include/proton/tracker.hpp  |  7 +++++++
 cpp/include/proton/transfer.hpp | 15 +++++++++++++--
 cpp/src/delivery.cpp            |  2 +-
 cpp/src/tracker.cpp             |  2 +-
 cpp/src/transfer.cpp            |  2 ++
 8 files changed, 38 insertions(+), 6 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


(qpid-proton) 01/02: PROTON-2873: Make it easier to switch between disposition types

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit e1695bc5e1013f65777af8ef2a92a62b9609e047
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Sun Apr 26 19:45:29 2026 -0400

    PROTON-2873: Make it easier to switch between disposition types
    
    Add pn_disposition_clear to exposed API so that you can set a
    change the disposition type and parameters of a disposition that is
    already set using the new disposition API.
    
    Doing this is an unusual case, but occurs when you have an incoming
    delivery inside a transaction which has been transactionally
    acknowledged but the transaction aborts or commit fails and now needs to
    be have a modified disposition.
---
 c/include/proton/disposition.h | 7 +++++++
 c/src/core/engine-internal.h   | 2 --
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/c/include/proton/disposition.h b/c/include/proton/disposition.h
index 7d7fdee3b..ee4b27966 100644
--- a/c/include/proton/disposition.h
+++ b/c/include/proton/disposition.h
@@ -124,6 +124,13 @@ PN_EXTERN uint64_t pn_disposition_type(pn_disposition_t *disposition);
  */
 PN_EXTERN const char *pn_disposition_type_name(uint64_t disposition_type);
 
+/**
+ * Clear a disposition.
+ *
+ * @param[in] disposition a disposition object
+ */
+PN_EXTERN void pn_disposition_clear(pn_disposition_t *disposition);
+
 /**
  * Access the condition object associated with a disposition.
  *
diff --git a/c/src/core/engine-internal.h b/c/src/core/engine-internal.h
index 5bab0f7bd..76cabbdc4 100644
--- a/c/src/core/engine-internal.h
+++ b/c/src/core/engine-internal.h
@@ -427,8 +427,6 @@ void pn_transport_sasl_init(pn_transport_t *transport);
 void pn_condition_init(pn_condition_t *condition);
 void pn_condition_tini(pn_condition_t *condition);
 
-void pn_disposition_clear(pn_disposition_t *ds);
-
 void pn_modified(pn_connection_t *connection, pn_endpoint_t *endpoint, bool emit);
 void pn_real_settle(pn_delivery_t *delivery);  // will free delivery if link is freed
 void pn_clear_tpwork(pn_delivery_t *delivery);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


(qpid-proton) 02/02: PROTON-2932: [C++] Allow proton::transfer to be hashed

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 490d64a25d6b526c6df2de9d8b35f42ef66a5fc6
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Fri May 1 18:45:46 2026 -0400

    PROTON-2932: [C++] Allow proton::transfer to be hashed
---
 cpp/include/proton/delivery.hpp |  7 +++++++
 cpp/include/proton/tracker.hpp  |  7 +++++++
 cpp/include/proton/transfer.hpp | 15 +++++++++++++--
 cpp/src/delivery.cpp            |  2 +-
 cpp/src/tracker.cpp             |  2 +-
 cpp/src/transfer.cpp            |  2 ++
 6 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/cpp/include/proton/delivery.hpp b/cpp/include/proton/delivery.hpp
index f60ea5438..8278c6a48 100644
--- a/cpp/include/proton/delivery.hpp
+++ b/cpp/include/proton/delivery.hpp
@@ -98,4 +98,11 @@ typedef internal::iter_range<delivery_iterator> delivery_range;
 
 } // proton
 
+/// Specialize std::hash so we can use proton::delivery as a key for unordered datastructures
+template <> struct std::hash<proton::delivery> {
+  std::size_t operator()(const proton::delivery& k) const {
+      return std::hash<proton::binary>{}(k.tag());
+  }
+};
+
 #endif // PROTON_DELIVERY_HPP
diff --git a/cpp/include/proton/tracker.hpp b/cpp/include/proton/tracker.hpp
index 0c5efef27..c8c2748c4 100644
--- a/cpp/include/proton/tracker.hpp
+++ b/cpp/include/proton/tracker.hpp
@@ -83,4 +83,11 @@ typedef internal::iter_range<tracker_iterator> tracker_range;
 
 } // proton
 
+/// Specialize std::hash so we can use proton::tracker as a key for unordered datastructures
+template <> struct std::hash<proton::tracker> {
+  std::size_t operator()(const proton::tracker& k) const {
+      return std::hash<proton::binary>{}(k.tag());
+  }
+};
+
 #endif // PROTON_TRACKER_HPP
diff --git a/cpp/include/proton/transfer.hpp b/cpp/include/proton/transfer.hpp
index cf0474a75..afbf6c5ed 100644
--- a/cpp/include/proton/transfer.hpp
+++ b/cpp/include/proton/transfer.hpp
@@ -22,6 +22,7 @@
  *
  */
 
+#include "./binary.hpp"
 #include "./fwd.hpp"
 #include "./internal/export.hpp"
 #include "./internal/object.hpp"
@@ -77,6 +78,9 @@ class transfer : public internal::object<pn_delivery_t> {
     /// Return true if the transfer has been settled.
     PN_CPP_EXTERN bool settled() const;
 
+    /// Return the tag for this transfer.
+    PN_CPP_EXTERN binary tag() const;
+
     /// Set user data on this transfer.
     PN_CPP_EXTERN void user_data(void* user_data) const;
 
@@ -88,11 +92,18 @@ class transfer : public internal::object<pn_delivery_t> {
     /// @endcond
 };
 
-/// Human-readalbe name of the transfer::state
+/// Human-readable name of the transfer::state
 PN_CPP_EXTERN std::string to_string(enum transfer::state);
-/// Human-readalbe name of the transfer::state
+/// Human-readable name of the transfer::state
 PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const enum transfer::state);
 
 } // proton
 
+/// Specialize std::hash so we can use proton::transfer as a key for unordered datastructures
+template <> struct std::hash<proton::transfer> {
+  std::size_t operator()(const proton::transfer& k) const {
+      return std::hash<proton::binary>{}(k.tag());
+  }
+};
+
 #endif // PROTON_TRANSFER_HPP
diff --git a/cpp/src/delivery.cpp b/cpp/src/delivery.cpp
index 102eca671..72066f38f 100644
--- a/cpp/src/delivery.cpp
+++ b/cpp/src/delivery.cpp
@@ -57,7 +57,7 @@ namespace proton {
 
 delivery::delivery(pn_delivery_t* d): transfer(make_wrapper(d)) {}
 receiver delivery::receiver() const { return make_wrapper<class receiver>(pn_delivery_link(pn_object())); }
-binary delivery::tag() const { return bin(pn_delivery_tag(pn_object())); }
+binary delivery::tag() const { return transfer::tag(); }
 delivery::~delivery() = default;
 void delivery::accept() { settle_delivery(pn_object(), ACCEPTED); }
 void delivery::reject() { settle_delivery(pn_object(), REJECTED); }
diff --git a/cpp/src/tracker.cpp b/cpp/src/tracker.cpp
index 3f4db11aa..30f06a242 100644
--- a/cpp/src/tracker.cpp
+++ b/cpp/src/tracker.cpp
@@ -34,7 +34,7 @@ namespace proton {
 
 tracker::tracker(pn_delivery_t *d): transfer(make_wrapper(d)) {}
 sender tracker::sender() const { return make_wrapper<class sender>(pn_delivery_link(pn_object())); }
-binary tracker::tag() const { return bin(pn_delivery_tag(pn_object())); }
+binary tracker::tag() const { return transfer::tag(); }
 
 tracker_iterator tracker_iterator::operator++() {
     if (!!obj_) {
diff --git a/cpp/src/transfer.cpp b/cpp/src/transfer.cpp
index 5fdf34ecd..c3a0ff829 100644
--- a/cpp/src/transfer.cpp
+++ b/cpp/src/transfer.cpp
@@ -29,6 +29,7 @@
 #include <proton/session.h>
 
 #include "proton_bits.hpp"
+#include "types_internal.hpp"
 
 #include <ostream>
 
@@ -45,6 +46,7 @@ bool transfer::settled() const { return pn_delivery_settled(pn_object()); }
 void transfer::settle() { pn_delivery_settle(pn_object()); }
 
 enum transfer::state transfer::state() const { return static_cast<enum state>(pn_delivery_remote_state(pn_object())); }
+binary transfer::tag() const { return bin(pn_delivery_tag(pn_object())); }
 
 std::string to_string(enum transfer::state s) { return pn_disposition_type_name(s); }
 std::ostream& operator<<(std::ostream& o, const enum transfer::state s) { return o << to_string(s); }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org