Skip to content

Commit 4e90a03

Browse files
committed
wait the future to complete when reset
1 parent 661105a commit 4e90a03

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

source/s3_parallel_input_stream.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,12 @@ static struct aws_input_stream_vtable s_aws_s3_mmap_part_streaming_input_stream_
369369
void aws_streaming_input_stream_reset(struct aws_input_stream *stream) {
370370
struct aws_s3_mmap_part_streaming_input_stream_impl *impl =
371371
AWS_CONTAINER_OF(stream, struct aws_s3_mmap_part_streaming_input_stream_impl, base);
372+
if (impl->loading_future) {
373+
/* If there is a loading future, wait for it to complete. */
374+
/* TODO: probably better to cancel the future, but we don't support cancel yet */
375+
aws_future_bool_wait(impl->loading_future, MAX_TIMEOUT_NS_P);
376+
aws_future_bool_release(impl->loading_future);
377+
}
372378
impl->total_length_read = 0;
373379
impl->eos_loaded = false;
374380
impl->eos_reached = false;

0 commit comments

Comments
 (0)