Browse Source

ntex: fix ntex-raw, update deps (#6380)

Nikolay Kim 4 years ago
parent
commit
f1b1c41dad

+ 5 - 5
frameworks/Rust/ntex/Cargo.toml

@@ -16,19 +16,19 @@ name = "ntex-raw"
 path = "src/main_raw.rs"
 
 [dependencies]
-ntex = "0.2.0-b.9"
-mimalloc = { version = "0.1.22", default-features = false }
-snmalloc-rs = { version = "0.2.23", features = ["1mib", "native-cpu"] }
+ntex = "0.2.0-b.12"
+snmalloc-rs = { version = "0.2.24", features = ["1mib", "native-cpu"] }
 yarte = { version = "0.14", features = ["bytes-buf", "json"] }
 env_logger = "0.8"
 random-fast-rng = "0.1.1"
 bytes = "0.5.6"
-atoi = "0.3.2"
+atoi = "0.4.0"
 num_cpus = "1.13"
 futures = "0.3.12"
 http = "0.2"
 smallvec = "1.6.1"
-simd-json = "0.3.23"
+simd-json = "0.3.24"
+
 simd-json-derive = "0.1.15"
 serde = { version = "1.0", features = ["derive"] }
 log = { version = "0.4", features = ["release_max_level_off"] }

+ 2 - 1
frameworks/Rust/ntex/src/main.rs

@@ -1,5 +1,5 @@
 #[global_allocator]
-static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
+static GLOBAL: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;
 
 use bytes::Bytes;
 use ntex::{http, web};
@@ -62,6 +62,7 @@ async fn main() -> std::io::Result<()> {
             http::HttpService::build()
                 .keep_alive(http::KeepAlive::Os)
                 .client_timeout(0)
+                .disconnect_timeout(0)
                 .h1(ntex::map_config(
                     web::App::new()
                         .service(web::resource("/json").to(json))

+ 3 - 4
frameworks/Rust/ntex/src/main_db.rs

@@ -1,9 +1,7 @@
 #[global_allocator]
-static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
+static GLOBAL: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;
 
-use std::future::Future;
-use std::pin::Pin;
-use std::task::{Context, Poll};
+use std::{future::Future, pin::Pin, task::Context, task::Poll};
 
 use bytes::BytesMut;
 use futures::future::ok;
@@ -148,6 +146,7 @@ async fn main() -> std::io::Result<()> {
             HttpService::build()
                 .keep_alive(KeepAlive::Os)
                 .client_timeout(0)
+                .disconnect_timeout(0)
                 .h1(AppFactory)
                 .tcp()
         })?

+ 3 - 3
frameworks/Rust/ntex/src/main_raw.rs

@@ -1,5 +1,5 @@
 #[global_allocator]
-static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
+static GLOBAL: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;
 
 use std::{
     cell::RefCell, future::Future, io, pin::Pin, rc::Rc, task::Context, task::Poll,
@@ -76,7 +76,7 @@ impl Future for App {
         }
         if !this.state.is_read_ready() {
             this.state.dsp_read_more_data(cx.waker());
-        } else if !updated {
+        } else {
             this.state.dsp_register_task(cx.waker());
         }
         Poll::Pending
@@ -92,7 +92,7 @@ async fn main() -> io::Result<()> {
         .backlog(1024)
         .bind("techempower", "0.0.0.0:8080", || {
             fn_service(|io: TcpStream| {
-                let state = State::new();
+                let state = State::new().disconnect_timeout(0);
                 let io = Rc::new(RefCell::new(io));
                 ntex::rt::spawn(ReadTask::new(io.clone(), state.clone()));
                 ntex::rt::spawn(WriteTask::new(io, state.clone()));