Browse Source

upgrade ntex (#6801)

Nikolay Kim 3 years ago
parent
commit
16578a57dc

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

@@ -16,7 +16,7 @@ name = "ntex-raw"
 path = "src/main_raw.rs"
 
 [dependencies]
-ntex = "0.4.0-b.1"
+ntex = "0.4.0-b.12"
 mimalloc = { version = "0.1.25", default-features = false }
 snmalloc-rs = { version = "0.2.26", features = ["1mib", "native-cpu"] }
 yarte = { version = "0.15", features = ["bytes-buf", "json"] }

+ 1 - 1
frameworks/Rust/ntex/ntex-db.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.53.0
+FROM rust:1.54.0
 
 # Disable simd at jsonescape
 # ENV CARGO_CFG_JSONESCAPE_DISABLE_AUTO_SIMD=

+ 1 - 1
frameworks/Rust/ntex/ntex-raw.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.53.0
+FROM rust:1.54.0
 
 # Disable simd at jsonescape
 # ENV CARGO_CFG_JSONESCAPE_DISABLE_AUTO_SIMD=

+ 1 - 1
frameworks/Rust/ntex/ntex.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.53.0
+FROM rust:1.54.0
 
 # Disable simd at jsonescape
 # ENV CARGO_CFG_JSONESCAPE_DISABLE_AUTO_SIMD=

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

@@ -2,7 +2,7 @@
 static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
 
 use ntex::http::header::{HeaderValue, CONTENT_TYPE, SERVER};
-use ntex::{http, util::Bytes, web};
+use ntex::{http, util::Bytes, web, time::Seconds};
 use yarte::Serialize;
 
 mod utils;
@@ -44,8 +44,8 @@ async fn main() -> std::io::Result<()> {
         .bind("techempower", "0.0.0.0:8080", || {
             http::HttpService::build()
                 .keep_alive(http::KeepAlive::Os)
-                .client_timeout(0)
-                .disconnect_timeout(0)
+                .client_timeout(Seconds(0))
+                .disconnect_timeout(Seconds(0))
                 .buffer_params(65535, 65535, 1024)
                 .h1(web::App::new()
                     .service(json)

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

@@ -7,7 +7,7 @@ use futures::future::{ok, Future, FutureExt};
 use ntex::http::header::{HeaderValue, CONTENT_TYPE, SERVER};
 use ntex::http::{HttpService, KeepAlive, Request, Response};
 use ntex::service::{Service, ServiceFactory};
-use ntex::util::BytesMut;
+use ntex::{util::BytesMut, time::Seconds};
 use ntex::web::{Error, HttpResponse};
 
 mod db;
@@ -100,8 +100,8 @@ async fn main() -> std::io::Result<()> {
         .bind("techempower", "0.0.0.0:8080", || {
             HttpService::build()
                 .keep_alive(KeepAlive::Os)
-                .client_timeout(0)
-                .disconnect_timeout(0)
+                .client_timeout(Seconds(0))
+                .disconnect_timeout(Seconds(0))
                 .buffer_params(65535, 65535, 1024)
                 .h1(AppFactory)
                 .tcp()

+ 2 - 4
frameworks/Rust/ntex/src/main_raw.rs

@@ -3,10 +3,8 @@ static GLOBAL: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;
 
 use std::{cell::RefCell, future::Future, io, pin::Pin, rc::Rc, task::Context, task::Poll};
 
-use ntex::fn_service;
+use ntex::{fn_service, time::Seconds, http::h1, rt::net::TcpStream};
 use ntex::framed::{ReadTask, State, WriteTask};
-use ntex::http::h1;
-use ntex::rt::net::TcpStream;
 
 mod utils;
 
@@ -98,7 +96,7 @@ async fn main() -> io::Result<()> {
         .backlog(1024)
         .bind("techempower", "0.0.0.0:8080", || {
             fn_service(|io: TcpStream| {
-                let state = State::with_params(65535, 65535, 1024, 0);
+                let state = State::with_params(65535, 65535, 1024, Seconds(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()));