From 07bfc59b58fd45269154b8a3aef15b8c86c3f799 Mon Sep 17 00:00:00 2001 From: Bret Ambrose Date: Mon, 26 Jun 2023 13:03:22 -0700 Subject: [PATCH] CR feedback --- include/aws/mqtt/private/v5/mqtt3_to_mqtt5_adapter_impl.h | 8 ++------ source/v5/mqtt3_to_mqtt5_adapter.c | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/aws/mqtt/private/v5/mqtt3_to_mqtt5_adapter_impl.h b/include/aws/mqtt/private/v5/mqtt3_to_mqtt5_adapter_impl.h index da5378c4..8c78bd3b 100644 --- a/include/aws/mqtt/private/v5/mqtt3_to_mqtt5_adapter_impl.h +++ b/include/aws/mqtt/private/v5/mqtt3_to_mqtt5_adapter_impl.h @@ -86,6 +86,7 @@ struct aws_mqtt3_to_mqtt5_adapter_operation_publish { Create cross thread task Create adapter op -> Create and attach mqtt5 op allocate id and add operation to adapter table + Add adapter op's internal ref to adapter submit cross thread task to event loop return id or 0 @@ -98,7 +99,7 @@ struct aws_mqtt3_to_mqtt5_adapter_operation_publish { if terminated: remove adapter op from table destroy adapter op - Release internal ref to adapter + Release adapter op's internal ref to adapter On publish completion: Safe handler: @@ -252,11 +253,6 @@ AWS_MQTT_API void aws_mqtt3_to_mqtt5_adapter_operation_table_init( struct aws_mqtt3_to_mqtt5_adapter_operation_table *table, struct aws_allocator *allocator); -/* - * Q: No call backs because by the time we call clean up we're terminated. Cancel all ops though? - * A: We haven't released our mqtt5 client reference yet so we are safe to internally manipulate (release our ref and - * zero completion callbacks) - */ AWS_MQTT_API void aws_mqtt3_to_mqtt5_adapter_operation_table_clean_up( struct aws_mqtt3_to_mqtt5_adapter_operation_table *table); diff --git a/source/v5/mqtt3_to_mqtt5_adapter.c b/source/v5/mqtt3_to_mqtt5_adapter.c index 8a6c83a7..c033118e 100644 --- a/source/v5/mqtt3_to_mqtt5_adapter.c +++ b/source/v5/mqtt3_to_mqtt5_adapter.c @@ -1761,6 +1761,8 @@ void aws_mqtt3_to_mqtt5_adapter_operation_table_clean_up(struct aws_mqtt3_to_mqt aws_hash_table_foreach(&table->operations, s_adapter_operation_clean_up, table); aws_hash_table_clean_up(&table->operations); + + aws_mutex_clean_up(&table->lock); } static uint16_t s_next_adapter_id(uint16_t current_id) {