Skip to content

Commit 19648ef

Browse files
committed
more logging
1 parent 7ae6740 commit 19648ef

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

source/v5/mqtt5_client.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,9 +622,10 @@ static void s_aws_mqtt5_reset_manual_puback_tables(
622622
struct aws_mqtt5_client_operational_state *client_operational_state) {
623623
size_t count = aws_hash_table_get_entry_count(&client_operational_state->manual_puback_control_id_table);
624624
if (count > 0) {
625-
AWS_LOGF_INFO(
625+
AWS_LOGF_DEBUG(
626626
AWS_LS_MQTT5_CLIENT,
627-
"id=%p: Clearing %zu manual PUBACK control ids.",
627+
"id=%p: Clearing %zu PUBACKs under user control. Previously controlled PUBACKs are no longer valid and "
628+
"have been cancelled.",
628629
(void *)client_operational_state->client,
629630
count);
630631
aws_hash_table_clear(&client_operational_state->manual_puback_packet_id_table);
@@ -2653,6 +2654,10 @@ uint64_t aws_mqtt5_client_acquire_puback(
26532654
/* In this case we simply provide the same control_id that was already sent before. We do not want to create a
26542655
* second control_id with the same packet_id. It is the user's responsibility to know that they have two PUBACKs
26552656
* for the same PUBLISH. */
2657+
AWS_LOGF_WARN(
2658+
AWS_LS_MQTT5_CLIENT,
2659+
"id=%p: PUBACK acquire called on a PUBLISH that is already under user control.",
2660+
(void *)client);
26562661
struct aws_mqtt5_manual_puback_entry *entry = elem->value;
26572662
return entry->puback_control_id;
26582663
}
@@ -2698,6 +2703,25 @@ uint64_t aws_mqtt5_client_acquire_puback(
26982703

26992704
/* Increment next_mqtt5_puback_control_id for next use */
27002705
client->operational_state.next_mqtt5_puback_control_id = current_control_packet_id + 1;
2706+
2707+
size_t in_flight_unacked_publishes =
2708+
aws_hash_table_get_entry_count(&client->operational_state.manual_puback_control_id_table);
2709+
if (in_flight_unacked_publishes >= 100) {
2710+
AWS_LOGF_WARN(
2711+
AWS_LS_MQTT5_CLIENT,
2712+
"id=%p: 100 or more PUBACKs under user control: %zu. AWS IoT Core limits of 100 in-flight has been met or "
2713+
"exceeded.",
2714+
(void *)client,
2715+
in_flight_unacked_publishes);
2716+
} else {
2717+
AWS_LOGF_DEBUG(
2718+
AWS_LS_MQTT5_CLIENT,
2719+
"id=%p: Manual PUBACK control taken for a PUBLISH packet. Current in-flight PUBACKs under user control: "
2720+
"%zu",
2721+
(void *)client,
2722+
in_flight_unacked_publishes);
2723+
}
2724+
27012725
return manual_puback->puback_control_id;
27022726

27032727
cleanup:

0 commit comments

Comments
 (0)