qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [76/89] [abbrv] qpid-proton git commit: PROTON-1514: check for settled flag on all frames of multi-frame transfer; enforce sole legal transition is settled to unsettled. The previous revert at 6e15ddc was a false alarm.
Date Tue, 03 Jul 2018 22:14:05 GMT
PROTON-1514: check for settled flag on all frames of multi-frame transfer;
enforce sole legal transition is settled to unsettled.
The previous revert at 6e15ddc was a false alarm.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/2dda72c7
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/2dda72c7
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/2dda72c7

Branch: refs/heads/go1
Commit: 2dda72c703e1a2bffac1bbcd509205e5645c77d9
Parents: 94dfe1b
Author: Clifford Jansen <cliffjansen@apache.org>
Authored: Wed May 9 15:59:14 2018 -0700
Committer: Clifford Jansen <cliffjansen@apache.org>
Committed: Wed May 9 15:59:14 2018 -0700

----------------------------------------------------------------------
 c/src/core/transport.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2dda72c7/c/src/core/transport.c
----------------------------------------------------------------------
diff --git a/c/src/core/transport.c b/c/src/core/transport.c
index e0a2b5c..4f0e98f 100644
--- a/c/src/core/transport.c
+++ b/c/src/core/transport.c
@@ -1474,12 +1474,12 @@ int pn_do_transfer(pn_transport_t *transport, uint8_t frame_type,
uint16_t chann
   pn_sequence_t id;
   bool settled;
   bool more;
-  bool has_type;
+  bool has_type, settled_set;
   bool resume, aborted, batchable;
   uint64_t type;
   pn_data_clear(transport->disp_data);
-  int err = pn_data_scan(args, "D.[I?Iz.oo.D?LCooo]", &handle, &id_present, &id,
&tag,
-                         &settled, &more, &has_type, &type, transport->disp_data,
+  int err = pn_data_scan(args, "D.[I?Iz.?oo.D?LCooo]", &handle, &id_present, &id,
&tag,
+                         &settled_set, &settled, &more, &has_type, &type,
transport->disp_data,
                          &resume, &aborted, &batchable);
   if (err) return err;
   pn_session_t *ssn = pni_channel_state(transport, channel);
@@ -1498,6 +1498,8 @@ int pn_do_transfer(pn_transport_t *transport, uint8_t frame_type, uint16_t
chann
   pn_delivery_t *delivery;
   if (link->unsettled_tail && !link->unsettled_tail->done) {
     delivery = link->unsettled_tail;
+    if (settled_set && !settled && delivery->remote.settled)
+      return pn_do_error(transport, "amqp:invalid-field", "invalid transition from settled
to unsettled");
   } else {
     pn_delivery_map_t *incoming = &ssn->state.incoming;
 
@@ -1522,19 +1524,19 @@ int pn_do_transfer(pn_transport_t *transport, uint8_t frame_type,
uint16_t chann
     link->state.delivery_count++;
     link->state.link_credit--;
     link->queued++;
-
-    // XXX: need to fill in remote state: delivery->remote.state = ...;
-    delivery->remote.settled = settled;
-    if (settled) {
-      delivery->updated = true;
-      pn_work_update(transport->connection, delivery);
-    }
   }
 
   pn_buffer_append(delivery->bytes, payload->start, payload->size);
   ssn->incoming_bytes += payload->size;
   delivery->done = !more;
 
+  // XXX: need to fill in remote state: delivery->remote.state = ...;
+  if (settled && !delivery->remote.settled) {
+    delivery->remote.settled = settled;
+    delivery->updated = true;
+    pn_work_update(transport->connection, delivery);
+  }
+
   ssn->state.incoming_transfer_count++;
   ssn->state.incoming_window--;
 


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


Mime
View raw message