You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by cl...@apache.org on 2022/11/07 07:48:59 UTC
[qpid-proton] branch main updated: PROTON-2647: make send-abort example handle variations in number of FLOW events
This is an automated email from the ASF dual-hosted git repository.
cliffjansen 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 6255d0b46 PROTON-2647: make send-abort example handle variations in number of FLOW events
6255d0b46 is described below
commit 6255d0b4698472d45a15550a217be0aa07277db2
Author: Clifford Jansen <cl...@apache.org>
AuthorDate: Sun Nov 6 23:47:58 2022 -0800
PROTON-2647: make send-abort example handle variations in number of FLOW events
---
c/examples/send-abort.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/c/examples/send-abort.c b/c/examples/send-abort.c
index d68352063..7f28addb3 100644
--- a/c/examples/send-abort.c
+++ b/c/examples/send-abort.c
@@ -137,19 +137,25 @@ static bool handle(app_data_t* app, pn_event_t* event) {
pn_delivery(sender, pn_dtag((const char *)&app->sent, sizeof(app->sent)));
pn_link_send(sender, msgbuf.start, msgbuf.size - HOLDBACK); /* Send some part of message */
app->in_progress = true;
- /* Return from this link flow event and abort the message on next, */
+ /* Return from this link flow event and abort the message on future FLOW, */
break;
} else {
pn_delivery_t * pnd = pn_link_current(sender);
- pn_delivery_abort(pnd);
- /* aborted delivery is presettled and never ack'd. */
- if (++app->aborted == app->message_count) {
- printf("%d messages started and aborted\n", app->aborted);
- pn_connection_close(pn_event_connection(event));
- /* Continue handling events till we receive TRANSPORT_CLOSED */
+ if (pn_delivery_pending(pnd) == 0) {
+ // All message data from pn_link_send has been processed to physical frames.
+ pn_delivery_abort(pnd);
+ /* aborted delivery is presettled and never ack'd. */
+ if (++app->aborted == app->message_count) {
+ printf("%d messages started and aborted\n", app->aborted);
+ pn_connection_close(pn_event_connection(event));
+ /* Continue handling events till we receive TRANSPORT_CLOSED */
+ }
+ ++app->sent;
+ app->in_progress = false;
+ } else {
+ // Keep checking FLOW events until all message data forwarded to peer.
+ break;
}
- ++app->sent;
- app->in_progress = false;
}
}
break;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org