File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -319,6 +319,7 @@ static void s_mqtt_request_response_client_final_destroy(struct aws_mqtt_request
319319 aws_mqtt_request_response_client_subscriptions_clean_up (& client -> subscriptions );
320320 aws_hash_table_clean_up (& client -> operations_by_correlation_tokens );
321321
322+ aws_event_loop_group_release_from_event_loop (client -> loop );
322323 aws_mem_release (client -> allocator , client );
323324
324325 if (terminate_callback != NULL ) {
@@ -1060,9 +1061,20 @@ static struct aws_mqtt_request_response_client *s_aws_mqtt_request_response_clie
10601061
10611062 rr_client -> allocator = allocator ;
10621063 rr_client -> config = * options ;
1063- rr_client -> loop = loop ;
10641064 rr_client -> state = AWS_RRCS_UNINITIALIZED ;
10651065
1066+ rr_client -> loop = loop ;
1067+ // kept a reference to the event loop group to keep the event loop alive. It should be released when the client is
1068+ // destroyed.
1069+ if (!aws_event_loop_group_acquire_from_event_loop (loop )) {
1070+ aws_mem_release (allocator , rr_client );
1071+ AWS_LOGF_ERROR (
1072+ AWS_LS_MQTT_REQUEST_RESPONSE ,
1073+ "(static) request response client creation failed - unable to acquire event loop group" );
1074+ aws_raise_error (AWS_ERROR_INVALID_ARGUMENT );
1075+ return NULL ;
1076+ }
1077+
10661078 aws_hash_table_init (
10671079 & rr_client -> operations ,
10681080 allocator ,
You can’t perform that action at this time.
0 commit comments