ChugR commented on a change in pull request #890:
URL: https://github.com/apache/qpid-dispatch/pull/890#discussion_r510516248



##########
File path: src/connection_manager.c
##########
@@ -438,25 +438,35 @@ static qd_error_t load_server_config(qd_dispatch_t *qd, 
qd_server_config_t *conf
         config->max_frame_size = QD_AMQP_MIN_MAX_FRAME_SIZE;
 
     //
-    // Given session frame count and max frame size compute session 
incoming_capacity
+    // Given session frame count and max frame size, compute session 
incoming_capacity
+    //   On 64-bit systems the capacity has no practial limit.
+    //   On 32-bit systems the largest default capacity is half the process 
address space.
     //
-    if (ssn_frames == 0)
-        config->incoming_capacity = (sizeof(size_t) < 8) ? 0x7FFFFFFFLL : 
0x7FFFFFFFLL * config->max_frame_size;
-    else {
-        uint64_t mfs      = (uint64_t) config->max_frame_size;
-        uint64_t trial_ic = ssn_frames * mfs;
-        uint64_t limit    = (sizeof(size_t) < 8) ? (1ll << 31) - 1 : 0;
-        if (limit == 0 || trial_ic < limit) {
-            // Silently promote incoming capacity of zero to one
-            config->incoming_capacity = 
-                (trial_ic < QD_AMQP_MIN_MAX_FRAME_SIZE ? 
QD_AMQP_MIN_MAX_FRAME_SIZE : trial_ic);
+    bool is_64bit = sizeof(size_t) == 8;
+#define MAX_32BIT_CAPACITY ((size_t)(2147483647))
+    if (ssn_frames == 0) {
+        config->incoming_capacity = is_64bit ? MAX_32BIT_CAPACITY * 
(size_t)config->max_frame_size : MAX_32BIT_CAPACITY;

Review comment:
       > Why do they differ? How do they interact? Does maxSessionWindow say 
default to 0, and overrides the value calculated by the other stuff if set?
   > 
   > Aside: what would it do if on a 32bit system the maxSessionWindow was 
configured above the '32bit cap' now calculated by the other bits, is it 
truncated before it is 'passed directly' (say giving similar effect to the 
overflow in calcs), or does the config cause a bang?
   > 
   They differ and fixing that is not the goal of this jira. If that's a 
problem then please file a new jira addressing that defect.
   
   Policy configuration overrides configuration of listeners and connectors.
   
   32-bit systems can't set int variables bigger than 2Gb.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to