summaryrefslogtreecommitdiff
path: root/ext/http/http_next.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/http/http_next.rs')
-rw-r--r--ext/http/http_next.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/ext/http/http_next.rs b/ext/http/http_next.rs
index 12db29b1b..8b2f91be0 100644
--- a/ext/http/http_next.rs
+++ b/ext/http/http_next.rs
@@ -17,6 +17,8 @@ use cache_control::CacheControl;
use deno_core::error::AnyError;
use deno_core::futures::TryFutureExt;
use deno_core::op;
+use deno_core::task::spawn;
+use deno_core::task::JoinHandle;
use deno_core::AsyncRefCell;
use deno_core::AsyncResult;
use deno_core::ByteString;
@@ -68,9 +70,6 @@ use std::rc::Rc;
use tokio::io::AsyncReadExt;
use tokio::io::AsyncWriteExt;
-use tokio::task::spawn_local;
-use tokio::task::JoinHandle;
-
type Request = hyper1::Request<Incoming>;
type Response = hyper1::Response<ResponseBytes>;
@@ -262,7 +261,7 @@ pub fn op_http_upgrade_raw(
let (read_rx, write_tx) = tokio::io::split(read);
let (mut write_rx, mut read_tx) = tokio::io::split(write);
- spawn_local(async move {
+ spawn(async move {
let mut upgrade_stream = WebSocketUpgrade::<ResponseBytes>::default();
// Stage 2: Extract the Upgraded connection
@@ -285,7 +284,7 @@ pub fn op_http_upgrade_raw(
// Stage 3: Pump the data
let (mut upgraded_rx, mut upgraded_tx) = tokio::io::split(upgraded);
- spawn_local(async move {
+ spawn(async move {
let mut buf = [0; 1024];
loop {
let read = upgraded_rx.read(&mut buf).await?;
@@ -296,7 +295,7 @@ pub fn op_http_upgrade_raw(
}
Ok::<_, AnyError>(())
});
- spawn_local(async move {
+ spawn(async move {
let mut buf = [0; 1024];
loop {
let read = write_rx.read(&mut buf).await?;
@@ -792,11 +791,10 @@ fn serve_https(
cancel: Rc<CancelHandle>,
tx: tokio::sync::mpsc::Sender<u32>,
) -> JoinHandle<Result<(), AnyError>> {
- // TODO(mmastrac): This is faster if we can use tokio::spawn but then the send bounds get us
let svc = service_fn(move |req: Request| {
new_slab_future(req, request_info.clone(), tx.clone())
});
- spawn_local(
+ spawn(
async {
io.handshake().await?;
// If the client specifically negotiates a protocol, we will use it. If not, we'll auto-detect
@@ -820,11 +818,10 @@ fn serve_http(
cancel: Rc<CancelHandle>,
tx: tokio::sync::mpsc::Sender<u32>,
) -> JoinHandle<Result<(), AnyError>> {
- // TODO(mmastrac): This is faster if we can use tokio::spawn but then the send bounds get us
let svc = service_fn(move |req: Request| {
new_slab_future(req, request_info.clone(), tx.clone())
});
- spawn_local(serve_http2_autodetect(io, svc).try_or_cancel(cancel))
+ spawn(serve_http2_autodetect(io, svc).try_or_cancel(cancel))
}
fn serve_http_on<HTTP>(
@@ -916,7 +913,7 @@ where
let cancel_clone = resource.cancel_handle();
let listen_properties_clone: HttpListenProperties = listen_properties.clone();
- let handle = spawn_local(async move {
+ let handle = spawn(async move {
loop {
let conn = listener
.accept()