Skip to content

Commit 20bcc7d

Browse files
committed
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 <[email protected]>
1 parent f1f0ffc commit 20bcc7d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ edition = "2018"
1919

2020
[dependencies]
2121
httparse = "1.3.4"
22-
async-std = "1.7.0"
2322
http-types = { version = "2.9.0", default-features = false }
2423
futures-core = "0.3.8"
2524
log = "0.4.11"
@@ -28,6 +27,7 @@ async-channel = "1.5.1"
2827
async-dup = "1.2.2"
2928
futures-lite = "1.13.0"
3029
async-io = "1.13.0"
30+
async-global-executor = "2.3.1"
3131

3232
[dev-dependencies]
3333
pretty_assertions = "0.6.1"

src/server/decode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
use std::str::FromStr;
44

55
use async_dup::{Arc, Mutex};
6-
use async_std::task;
76
use futures_lite::io::{AsyncRead as Read, AsyncWrite as Write, BufReader};
87
use futures_lite::prelude::*;
98
use http_types::content::ContentLength;
@@ -104,7 +103,7 @@ where
104103
let (body_read_sender, body_read_receiver) = async_channel::bounded(1);
105104

106105
if Some(CONTINUE_HEADER_VALUE) == req.header(EXPECT).map(|h| h.as_str()) {
107-
task::spawn(async move {
106+
async_global_executor::spawn(async move {
108107
// If the client expects a 100-continue header, spawn a
109108
// task to wait for the first read attempt on the body.
110109
if let Ok(()) = body_read_receiver.recv().await {
@@ -113,7 +112,8 @@ where
113112
// Since the sender is moved into the Body, this task will
114113
// finish when the client disconnects, whether or not
115114
// 100-continue was sent.
116-
});
115+
})
116+
.detach();
117117
}
118118

119119
// Check for Transfer-Encoding

0 commit comments

Comments
 (0)