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

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


The following commit(s) were added to refs/heads/main by this push:
     new 703b7b8f2 PROTON-2709: [C examples] Settle deliveries in sender example
703b7b8f2 is described below

commit 703b7b8f2b04f6e1196992787bdd113aa4862a6a
Author: Danis Ozdemir <ozdemi...@gmail.com>
AuthorDate: Thu Apr 6 13:40:00 2023 +0100

    PROTON-2709: [C examples] Settle deliveries in sender example
    
    If the delivery object is not settled on the sender side, the delivery
    object does not get returned to the pool of the link.
    
    Without the proposed fix, this code will mislead people and the code
    written based on this example will cause memory exhaustion in the long run.
---
 c/examples/send.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/c/examples/send.c b/c/examples/send.c
index 22a57f222..308a150bc 100644
--- a/c/examples/send.c
+++ b/c/examples/send.c
@@ -107,6 +107,7 @@ static bool handle(app_data_t* app, pn_event_t* event) {
      /* We received acknowledgement from the peer that a message was 
delivered. */
      pn_delivery_t* d = pn_event_delivery(event);
      if (pn_delivery_remote_state(d) == PN_ACCEPTED) {
+       pn_delivery_settle(d);
        if (++app->acknowledged == app->message_count) {
          printf("%d messages sent and acknowledged\n", app->acknowledged);
          pn_connection_close(pn_event_connection(event));


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

Reply via email to