You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2018/03/28 21:35:59 UTC

[2/2] qpid-proton git commit: PROTON-1809: Unable to receive messages when max-frame-size > 2^20

PROTON-1809: Unable to receive messages when max-frame-size > 2^20

The C transport code was computing the session incoming window as
session_capacity/max_frame_size, resulting in an incoming window that was always
0 if the frame size was bigger than session_capacity (default 2^20)

Fixes:

1. Removed the default session-capacity. Session flow control is only enabled
   if session-capacity and max-frame-size are *both* explicitly set.

2. If the specified session capacity is less than max-frame-size, it is
   automatically increased to be equal to max-frame-size to ensure at least one
   frame can be received.


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

Branch: refs/heads/master
Commit: e8de49d33b1c750327e6c9a090332953a7669a4d
Parents: 0f0de8d
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Mar 28 14:33:10 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Mar 28 17:25:41 2018 -0400

----------------------------------------------------------------------
 proton-c/src/core/engine.c    | 5 +++--
 proton-c/src/core/framing.h   | 1 +
 proton-c/src/core/transport.c | 8 +++++---
 3 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e8de49d3/proton-c/src/core/engine.c
----------------------------------------------------------------------
diff --git a/proton-c/src/core/engine.c b/proton-c/src/core/engine.c
index f49886d..070c751 100644
--- a/proton-c/src/core/engine.c
+++ b/proton-c/src/core/engine.c
@@ -20,6 +20,7 @@
  */
 
 #include "engine-internal.h"
+#include "framing.h"
 #include <stdlib.h>
 #include <string.h>
 #include "protocol.h"
@@ -987,12 +988,12 @@ pn_session_t *pn_session(pn_connection_t *conn)
   ssn->links = pn_list(PN_WEAKREF, 0);
   ssn->freed = pn_list(PN_WEAKREF, 0);
   ssn->context = pn_record();
-  ssn->incoming_capacity = 1024*1024;
+  ssn->incoming_capacity = 0;
   ssn->incoming_bytes = 0;
   ssn->outgoing_bytes = 0;
   ssn->incoming_deliveries = 0;
   ssn->outgoing_deliveries = 0;
-  ssn->outgoing_window = 2147483647;
+  ssn->outgoing_window = AMQP_MAX_WINDOW_SIZE;
 
   // begin transport state
   memset(&ssn->state, 0, sizeof(ssn->state));

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e8de49d3/proton-c/src/core/framing.h
----------------------------------------------------------------------
diff --git a/proton-c/src/core/framing.h b/proton-c/src/core/framing.h
index 792d664..92c1f7d 100644
--- a/proton-c/src/core/framing.h
+++ b/proton-c/src/core/framing.h
@@ -30,6 +30,7 @@
 
 #define AMQP_HEADER_SIZE (8)
 #define AMQP_MIN_MAX_FRAME_SIZE ((uint32_t)512) // minimum allowable max-frame
+#define AMQP_MAX_WINDOW_SIZE (2147483647)
 
 typedef struct {
   uint8_t type;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e8de49d3/proton-c/src/core/transport.c
----------------------------------------------------------------------
diff --git a/proton-c/src/core/transport.c b/proton-c/src/core/transport.c
index 96b54f2..b722991 100644
--- a/proton-c/src/core/transport.c
+++ b/proton-c/src/core/transport.c
@@ -1894,10 +1894,12 @@ static size_t pni_session_outgoing_window(pn_session_t *ssn)
 static size_t pni_session_incoming_window(pn_session_t *ssn)
 {
   uint32_t size = ssn->connection->transport->local_max_frame;
-  if (!size) {
-    return 2147483647; // biggest legal value
+  size_t cap = ssn->incoming_capacity;
+  if (size && cap) {    /* session flow control is enabled if both are specified */
+    if (cap < size) ssn->incoming_capacity = size; /* Must be able to hold 1 frame */
+    return (ssn->incoming_capacity - ssn->incoming_bytes) / size;
   } else {
-    return (ssn->incoming_capacity - ssn->incoming_bytes)/size;
+    return AMQP_MAX_WINDOW_SIZE;
   }
 }
 


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