From fb5c31416d4b9e526ca0fcc134dc8f366e367012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Souto?= Date: Wed, 11 Mar 2020 22:19:24 +0000 Subject: Add waker to StreamResource to fix hang on close bugs (#4293) --- cli/ops/fetch.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cli/ops/fetch.rs') diff --git a/cli/ops/fetch.rs b/cli/ops/fetch.rs index 9f36ad5fd..d222787a6 100644 --- a/cli/ops/fetch.rs +++ b/cli/ops/fetch.rs @@ -1,6 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use super::dispatch_json::{Deserialize, JsonOp, Value}; -use super::io::StreamResource; +use super::io::{StreamResource, StreamResourceHolder}; use crate::http_util::{create_http_client, HttpBody}; use crate::op_error::OpError; use crate::state::State; @@ -80,7 +80,9 @@ pub fn op_fetch( let mut state = state_.borrow_mut(); let rid = state.resource_table.add( "httpBody", - Box::new(StreamResource::HttpBody(Box::new(body))), + Box::new(StreamResourceHolder::new(StreamResource::HttpBody( + Box::new(body), + ))), ); let json_res = json!({ -- cgit v1.2.3