Skip to content

Commit

Permalink
Address theoretical possibility of a TPS-throttled getting lost
Browse files Browse the repository at this point in the history
  • Loading branch information
bretambrose committed Aug 21, 2023
1 parent a2ee9a3 commit 23d6b52
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/v5/mqtt5_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -3025,14 +3025,18 @@ int aws_mqtt5_client_service_operational_state(struct aws_mqtt5_client_operation
struct aws_mqtt5_operation *next_operation = NULL;
while (!aws_linked_list_empty(&client_operational_state->queued_operations)) {
struct aws_linked_list_node *next_operation_node =
aws_linked_list_pop_front(&client_operational_state->queued_operations);
aws_linked_list_front(&client_operational_state->queued_operations);
struct aws_mqtt5_operation *operation =
AWS_CONTAINER_OF(next_operation_node, struct aws_mqtt5_operation, node);

/* If this is a publish and we're throttled, just quit out of the loop. */
if (s_apply_publish_tps_flow_control(client, operation)) {
break;
}

/* Wait until flow control has passed before actually dequeuing the operation. */
aws_linked_list_pop_front(&client_operational_state->queued_operations);

if (!aws_mqtt5_operation_validate_vs_connection_settings(operation, client)) {
next_operation = operation;
break;
Expand Down

0 comments on commit 23d6b52

Please sign in to comment.