2019-06-13 17:10:51 -04:00
|
|
|
// <keep-alive>
|
|
|
|
use actix_web::{web, App, HttpResponse, HttpServer};
|
|
|
|
|
2019-12-29 03:32:56 +09:00
|
|
|
#[actix_rt::main]
|
|
|
|
async fn main() -> std::io::Result<()> {
|
2019-06-19 20:26:25 -04:00
|
|
|
let one = HttpServer::new(|| {
|
2019-06-13 17:10:51 -04:00
|
|
|
App::new().route("/", web::get().to(|| HttpResponse::Ok()))
|
|
|
|
})
|
|
|
|
.keep_alive(75); // <- Set keep-alive to 75 seconds
|
|
|
|
|
2019-06-19 20:26:25 -04:00
|
|
|
// let _two = HttpServer::new(|| {
|
|
|
|
// App::new().route("/", web::get().to(|| HttpResponse::Ok()))
|
|
|
|
// })
|
|
|
|
// .keep_alive(); // <- Use `SO_KEEPALIVE` socket option.
|
2019-06-13 17:10:51 -04:00
|
|
|
|
2019-06-19 20:26:25 -04:00
|
|
|
let _three = HttpServer::new(|| {
|
2019-06-13 17:10:51 -04:00
|
|
|
App::new().route("/", web::get().to(|| HttpResponse::Ok()))
|
|
|
|
})
|
|
|
|
.keep_alive(None); // <- Disable keep-alive
|
2019-06-19 20:26:25 -04:00
|
|
|
|
2019-12-29 03:32:56 +09:00
|
|
|
one.bind("127.0.0.1:8088")?.run().await
|
2019-06-13 17:10:51 -04:00
|
|
|
}
|
|
|
|
// </keep-alive>
|