File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -410,6 +410,7 @@ static void s_mqtt_request_response_client_final_destroy(struct aws_mqtt_request
410410 aws_hash_table_clean_up (& client -> request_response_paths );
411411 aws_hash_table_clean_up (& client -> operations_by_correlation_tokens );
412412
413+ aws_event_loop_group_release_from_event_loop (client -> loop );
413414 aws_mem_release (client -> allocator , client );
414415
415416 if (terminate_callback != NULL ) {
@@ -1152,6 +1153,18 @@ static struct aws_mqtt_request_response_client *s_aws_mqtt_request_response_clie
11521153
11531154 rr_client -> allocator = allocator ;
11541155 rr_client -> config = * options ;
1156+
1157+ // kept a reference to the event loop group to keep the event loop alive. It should be released when the client is
1158+ // destroyed.
1159+ if (!aws_event_loop_group_acquire_from_event_loop (loop )) {
1160+ aws_mem_release (allocator , rr_client );
1161+ AWS_LOGF_ERROR (
1162+ AWS_LS_MQTT_REQUEST_RESPONSE ,
1163+ "(static) request response client creation failed - unable to acquire event loop group" );
1164+ aws_raise_error (AWS_ERROR_INVALID_ARGUMENT );
1165+ return NULL ;
1166+ }
1167+
11551168 rr_client -> loop = loop ;
11561169 rr_client -> state = AWS_RRCS_UNINITIALIZED ;
11571170
You can’t perform that action at this time.
0 commit comments