ganeshmurthy commented on a change in pull request #847:
URL: https://github.com/apache/qpid-dispatch/pull/847#discussion_r492163426
##########
File path: src/connection_manager.c
##########
@@ -438,25 +438,37 @@ 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 limit.
+ // On 32-bit systems the largest capacity is AMQP_MAX_WINDWOW_SIZE.
//
- 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);
+ if (ssn_frames == 0) {
Review comment:
Can we remove this empty if (ssn_frames == 0) check and instead just say
if (ssn_frames != 0)
##########
File path: src/connection_manager.c
##########
@@ -438,25 +438,37 @@ 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 limit.
+ // On 32-bit systems the largest capacity is AMQP_MAX_WINDWOW_SIZE.
//
- 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);
+ if (ssn_frames == 0) {
Review comment:
Also can we change policy.c to only call
pn_session_set_incoming_capacity if the capacity is non-zero. I understand that
it is okay to call pn_session_set_incoming_capacity with a zero capacity but
not calling it seems clearer. Your call
----------------------------------------------------------------
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]