Skip to content

Commit 0975acd

Browse files
committed
fix the download to file path
1 parent a82e5de commit 0975acd

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

source/s3_meta_request.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,6 +1988,7 @@ static void s_s3_meta_request_event_delivery_task(struct aws_task *task, void *a
19881988
int error_code = AWS_ERROR_SUCCESS;
19891989
uint32_t num_parts_delivered = 0;
19901990
uint64_t bytes_allowed_to_deliver = 0;
1991+
uint64_t read_window_to_increment = 0;
19911992

19921993
/* BEGIN CRITICAL SECTION */
19931994
{
@@ -2007,6 +2008,9 @@ static void s_s3_meta_request_event_delivery_task(struct aws_task *task, void *a
20072008
aws_s3_meta_request_unlock_synced_data(meta_request);
20082009
}
20092010
/* END CRITICAL SECTION */
2011+
if (bytes_allowed_to_deliver > SIZE_MAX) {
2012+
bytes_allowed_to_deliver = SIZE_MAX;
2013+
}
20102014

20112015
/* Deliver all events */
20122016
for (size_t event_i = 0; event_i < aws_array_list_length(event_delivery_array); ++event_i) {
@@ -2036,7 +2040,7 @@ static void s_s3_meta_request_event_delivery_task(struct aws_task *task, void *a
20362040
/* If customer set the body callback, make sure we are not delivery them more than asked via the
20372041
* callback. */
20382042
aws_byte_cursor_advance(&response_body, bytes_delivered_for_request);
2039-
if (response_body.len > bytes_allowed_to_deliver) {
2043+
if (response_body.len > (size_t)bytes_allowed_to_deliver) {
20402044
response_body.len = bytes_allowed_to_deliver;
20412045
delivery_incomplete = true;
20422046
}
@@ -2087,7 +2091,7 @@ static void s_s3_meta_request_event_delivery_task(struct aws_task *task, void *a
20872091
aws_error_name(error_code));
20882092
}
20892093
if (meta_request->client->enable_read_backpressure) {
2090-
aws_s3_meta_request_increment_read_window(meta_request, response_body.len);
2094+
read_window_to_increment += response_body.len;
20912095
}
20922096
} else if (
20932097
meta_request->body_callback_ex != NULL &&
@@ -2214,6 +2218,7 @@ static void s_s3_meta_request_event_delivery_task(struct aws_task *task, void *a
22142218
aws_s3_meta_request_unlock_synced_data(meta_request);
22152219
}
22162220
/* END CRITICAL SECTION */
2221+
aws_s3_meta_request_increment_read_window(meta_request, read_window_to_increment);
22172222
aws_array_list_clean_up(&incomplete_deliver_events_array);
22182223

22192224
aws_s3_client_schedule_process_work(client);

tests/s3_data_plane_tests.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,6 +1755,9 @@ static int s_apply_backpressure_until_meta_request_finish(
17551755

17561756
/* Check that we haven't received more data than the window allows */
17571757
uint64_t max_data_allowed = accumulated_window_increments;
1758+
if (accumulated_data_size > max_data_allowed) {
1759+
AWS_FATAL_ASSERT(false);
1760+
}
17581761
ASSERT_TRUE(accumulated_data_size <= max_data_allowed, "Received more data than the read window allows");
17591762

17601763
/* If we're done, we're done */

0 commit comments

Comments
 (0)