1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-26 10:27:42 +02:00

update examples/tls/README

This commit is contained in:
ami44
2017-12-30 16:24:50 +01:00
parent 8e580ef7b9
commit a1dc5a6bd1
3 changed files with 22 additions and 5 deletions

View File

@ -7,6 +7,8 @@ use std::fs::File;
use std::io::Read;
use actix_web::*;
use actix::Arbiter;
use actix::actors::signal::{ProcessSignals, Subscribe};
/// somple handle
fn index(req: HttpRequest) -> Result<HttpResponse> {
@ -29,7 +31,7 @@ fn main() {
file.read_to_end(&mut pkcs12).unwrap();
let pkcs12 = Pkcs12::from_der(&pkcs12).unwrap().parse("12345").unwrap();
HttpServer::new(
let addr = HttpServer::new(
|| Application::new()
// enable logger
.middleware(middleware::Logger::default())
@ -45,6 +47,10 @@ fn main() {
.bind("127.0.0.1:8443").unwrap()
.start_ssl(&pkcs12).unwrap();
// Subscribe to unix signals
let signals = Arbiter::system_registry().get::<ProcessSignals>();
signals.send(Subscribe(addr.subscriber()));
println!("Started http server: 127.0.0.1:8443");
let _ = sys.run();
}