Use async-global-executor to spawn tasks

This is a placeholder until I figure out how to actually handle this
without the global executor.

Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
John Nunley 2023-09-20 20:28:18 -07:00
parent f1f0ffc628
commit 20bcc7da32
No known key found for this signature in database
GPG Key ID: 397D2B00FEA368AA
2 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,6 @@ edition = "2018"
[dependencies]
httparse = "1.3.4"
async-std = "1.7.0"
http-types = { version = "2.9.0", default-features = false }
futures-core = "0.3.8"
log = "0.4.11"
@ -28,6 +27,7 @@ async-channel = "1.5.1"
async-dup = "1.2.2"
futures-lite = "1.13.0"
async-io = "1.13.0"
async-global-executor = "2.3.1"
[dev-dependencies]
pretty_assertions = "0.6.1"

View File

@ -3,7 +3,6 @@
use std::str::FromStr;
use async_dup::{Arc, Mutex};
use async_std::task;
use futures_lite::io::{AsyncRead as Read, AsyncWrite as Write, BufReader};
use futures_lite::prelude::*;
use http_types::content::ContentLength;
@ -104,7 +103,7 @@ where
let (body_read_sender, body_read_receiver) = async_channel::bounded(1);
if Some(CONTINUE_HEADER_VALUE) == req.header(EXPECT).map(|h| h.as_str()) {
task::spawn(async move {
async_global_executor::spawn(async move {
// If the client expects a 100-continue header, spawn a
// task to wait for the first read attempt on the body.
if let Ok(()) = body_read_receiver.recv().await {
@ -113,7 +112,8 @@ where
// Since the sender is moved into the Body, this task will
// finish when the client disconnects, whether or not
// 100-continue was sent.
});
})
.detach();
}
// Check for Transfer-Encoding