Skip to content

Commit a82e5de

Browse files
committed
make sure there is no more data received
1 parent 3a9d56a commit a82e5de

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

source/s3_meta_request.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,7 @@ static void s_s3_meta_request_event_delivery_task(struct aws_task *task, void *a
20162016

20172017
case AWS_S3_META_REQUEST_EVENT_RESPONSE_BODY: {
20182018
struct aws_s3_request *request = event.u.response_body.completed_request;
2019-
uint64_t bytes_delivered_for_request = event.u.response_body.bytes_delivered;
2019+
size_t bytes_delivered_for_request = event.u.response_body.bytes_delivered;
20202020
AWS_ASSERT(meta_request == request->meta_request);
20212021
bool delivery_incomplete = false;
20222022
struct aws_byte_cursor response_body = aws_byte_cursor_from_buf(&request->send_data.response_body);

tests/s3_data_plane_tests.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,11 +1753,8 @@ static int s_apply_backpressure_until_meta_request_finish(
17531753
size_t received_body_size_delta = aws_atomic_exchange_int(&test_results->received_body_size_delta, 0);
17541754
accumulated_data_size += (uint64_t)received_body_size_delta;
17551755

1756-
/* Check that we haven't received more data than the window allows.
1757-
* TODO: Stop allowing "hacky wiggle room". The current implementation
1758-
* may push more bytes to the user (up to 1 part) than they've asked for. */
1759-
uint64_t hacky_wiggle_room = part_size;
1760-
uint64_t max_data_allowed = accumulated_window_increments + hacky_wiggle_room;
1756+
/* Check that we haven't received more data than the window allows */
1757+
uint64_t max_data_allowed = accumulated_window_increments;
17611758
ASSERT_TRUE(accumulated_data_size <= max_data_allowed, "Received more data than the read window allows");
17621759

17631760
/* If we're done, we're done */
@@ -1891,7 +1888,7 @@ static int s_test_s3_get_object_backpressure_small_increments(struct aws_allocat
18911888
size_t file_size = 1 * 1024 * 1024; /* Test downloads 1MB file */
18921889
size_t part_size = file_size / 4;
18931890
size_t window_initial_size = 1024;
1894-
uint64_t window_increment_size = part_size / 2;
1891+
uint64_t window_increment_size = part_size / 4;
18951892
return s_test_s3_get_object_backpressure_helper(
18961893
allocator, part_size, window_initial_size, window_increment_size, false);
18971894
}

0 commit comments

Comments
 (0)