1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 18:09:22 +02:00

subscriber to os signals automatically

This commit is contained in:
Nikolay Kim
2018-01-05 16:32:36 -08:00
parent 473ec38439
commit 3ed9e872ad
17 changed files with 81 additions and 214 deletions

View File

@ -7,7 +7,7 @@ use std::fs::File;
use std::io::Read;
use actix_web::*;
use actix::actors::signal::{ProcessSignals, Subscribe};
/// somple handle
fn index(req: HttpRequest) -> Result<HttpResponse> {
@ -46,10 +46,6 @@ fn main() {
.bind("127.0.0.1:8443").unwrap()
.start_ssl(&pkcs12).unwrap();
// Subscribe to unix signals
let signals = actix::Arbiter::system_registry().get::<ProcessSignals>();
signals.send(Subscribe(addr.subscriber()));
println!("Started http server: 127.0.0.1:8443");
let _ = sys.run();
}