@@ -207,6 +207,11 @@ struct aws_http_connection_manager {
207207 * a hybrid atomic/lock solution felt excessively complicated and delicate.
208208 */
209209 size_t external_ref_count ;
210+
211+ /*
212+ * if set to true, read back pressure mechanism will be enabled.
213+ */
214+ bool enable_read_back_pressure ;
210215};
211216
212217struct aws_http_connection_manager_snapshot {
@@ -560,12 +565,11 @@ struct aws_http_connection_manager *aws_http_connection_manager_new(
560565 }
561566
562567 struct aws_http_connection_manager * manager =
563- aws_mem_acquire (allocator , sizeof (struct aws_http_connection_manager ));
568+ aws_mem_calloc (allocator , 1 , sizeof (struct aws_http_connection_manager ));
564569 if (manager == NULL ) {
565570 return NULL ;
566571 }
567572
568- AWS_ZERO_STRUCT (* manager );
569573 manager -> allocator = allocator ;
570574
571575 if (aws_mutex_init (& manager -> lock )) {
@@ -612,6 +616,7 @@ struct aws_http_connection_manager *aws_http_connection_manager_new(
612616 manager -> external_ref_count = 1 ;
613617 manager -> shutdown_complete_callback = options -> shutdown_complete_callback ;
614618 manager -> shutdown_complete_user_data = options -> shutdown_complete_user_data ;
619+ manager -> enable_read_back_pressure = options -> enable_read_back_pressure ;
615620
616621 AWS_LOGF_INFO (AWS_LS_HTTP_CONNECTION_MANAGER , "id=%p: Successfully created" , (void * )manager );
617622
@@ -686,6 +691,7 @@ static int s_aws_http_connection_manager_new_connection(struct aws_http_connecti
686691 options .socket_options = & manager -> socket_options ;
687692 options .on_setup = s_aws_http_connection_manager_on_connection_setup ;
688693 options .on_shutdown = s_aws_http_connection_manager_on_connection_shutdown ;
694+ options .enable_read_back_pressure = manager -> enable_read_back_pressure ;
689695
690696 if (aws_http_connection_monitoring_options_is_valid (& manager -> monitoring_options )) {
691697 options .monitoring_options = & manager -> monitoring_options ;
@@ -844,13 +850,12 @@ void aws_http_connection_manager_acquire_connection(
844850 AWS_LOGF_DEBUG (AWS_LS_HTTP_CONNECTION_MANAGER , "id=%p: Acquire connection" , (void * )manager );
845851
846852 struct aws_http_connection_acquisition * request =
847- aws_mem_acquire (manager -> allocator , sizeof (struct aws_http_connection_acquisition ));
853+ aws_mem_calloc (manager -> allocator , 1 , sizeof (struct aws_http_connection_acquisition ));
848854 if (request == NULL ) {
849855 callback (NULL , aws_last_error (), user_data );
850856 return ;
851857 }
852858
853- AWS_ZERO_STRUCT (* request );
854859 request -> callback = callback ;
855860 request -> user_data = user_data ;
856861
0 commit comments