Skip to content

Commit 3146a6e

Browse files
committed
couple fix
1 parent 4e90a03 commit 3146a6e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

source/s3_auto_ranged_put.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,11 @@ struct aws_future_http_message *s_s3_prepare_upload_part(struct aws_s3_request *
10231023
/* Not the first time preparing request (e.g. retry).
10241024
* We can skip over the async steps that read the body stream */
10251025
/* Seek back to beginning of the stream. */
1026-
aws_streaming_input_stream_reset(request->request_stream);
1026+
aws_input_stream_release(request->request_stream);
1027+
uint64_t offset = 0;
1028+
size_t request_body_size = s_compute_request_body_size(meta_request, request->part_number, &offset);
1029+
request->request_stream = aws_input_stream_new_from_parallel_stream(
1030+
allocator, meta_request->request_body_parallel_stream, offset, request_body_size);
10271031
s_s3_prepare_upload_part_finish(part_prep, AWS_ERROR_SUCCESS);
10281032
}
10291033
} else if (request->num_times_prepared == 0) {

source/s3_parallel_input_stream.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ struct aws_parallel_input_stream_from_file_impl {
6969

7070
struct aws_string *file_path;
7171
struct aws_event_loop_group *reading_elg;
72-
size_t num_of_thread;
7372
};
7473

7574
static void s_para_from_file_destroy(struct aws_parallel_input_stream *stream) {
@@ -157,6 +156,7 @@ static void s_s3_parallel_from_file_read_task(struct aws_task *task, void *arg,
157156
} else {
158157
/* Return true if we reached EOF */
159158
bool eof_reached = (actually_read < read_task->length);
159+
AWS_ASSERT(!eof_reached);
160160
aws_future_bool_set_result(end_future, eof_reached);
161161
}
162162

@@ -297,7 +297,7 @@ static int s_aws_s3_mmap_part_streaming_input_stream_read(struct aws_input_strea
297297
struct aws_byte_buf *tmp = impl->reading_chunk_buf;
298298
impl->reading_chunk_buf = impl->loading_chunk_buf;
299299
impl->loading_chunk_buf = tmp;
300-
size_t new_offset = impl->offset + impl->total_length_read + impl->chunk_load_size;
300+
size_t new_offset = impl->offset + impl->total_length_read + impl->reading_chunk_buf->len;
301301
size_t new_load_length = aws_min_size(
302302
impl->chunk_load_size, impl->total_length - impl->total_length_read - impl->reading_chunk_buf->len);
303303
if (new_load_length > 0 && !impl->eos_loaded) {
@@ -322,6 +322,7 @@ static int s_aws_s3_mmap_part_streaming_input_stream_read(struct aws_input_strea
322322
if (impl->eos_loaded || impl->total_length_read == impl->total_length) {
323323
/* We reached the end of the stream. */
324324
impl->eos_reached = true;
325+
AWS_ASSERT(impl->total_length_read == impl->total_length);
325326
}
326327
}
327328

0 commit comments

Comments
 (0)