2018-08-22 06:11:16 +02:00
|
|
|
//! Actix net - framework for the compisible network services for Rust.
|
2018-08-19 19:47:04 +02:00
|
|
|
//!
|
|
|
|
//! ## Package feature
|
|
|
|
//!
|
|
|
|
//! * `tls` - enables ssl support via `native-tls` crate
|
2018-08-22 06:11:16 +02:00
|
|
|
//! * `ssl` - enables ssl support via `openssl` crate
|
2018-08-19 19:47:04 +02:00
|
|
|
//! * `rust-tls` - enables ssl support via `rustls` crate
|
|
|
|
//!
|
|
|
|
// #![warn(missing_docs)]
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
|
|
|
extern crate bytes;
|
2018-08-24 05:47:41 +02:00
|
|
|
#[macro_use]
|
2018-08-19 19:47:04 +02:00
|
|
|
extern crate failure;
|
|
|
|
extern crate futures;
|
|
|
|
extern crate mio;
|
|
|
|
extern crate net2;
|
|
|
|
extern crate num_cpus;
|
|
|
|
extern crate slab;
|
2018-08-24 05:47:41 +02:00
|
|
|
extern crate tokio;
|
2018-08-19 19:47:04 +02:00
|
|
|
extern crate tokio_io;
|
|
|
|
extern crate tokio_reactor;
|
|
|
|
extern crate tokio_tcp;
|
|
|
|
extern crate tokio_timer;
|
|
|
|
extern crate tower_service;
|
2018-08-24 05:47:41 +02:00
|
|
|
extern crate trust_dns_resolver;
|
2018-08-19 19:47:04 +02:00
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
extern crate actix;
|
|
|
|
|
|
|
|
#[cfg(feature = "tls")]
|
|
|
|
extern crate native_tls;
|
|
|
|
|
|
|
|
#[cfg(feature = "ssl")]
|
|
|
|
extern crate openssl;
|
|
|
|
#[cfg(feature = "ssl")]
|
|
|
|
extern crate tokio_openssl;
|
|
|
|
|
|
|
|
#[cfg(feature = "rust-tls")]
|
|
|
|
extern crate rustls;
|
|
|
|
#[cfg(feature = "rust-tls")]
|
|
|
|
extern crate tokio_rustls;
|
|
|
|
#[cfg(feature = "rust-tls")]
|
|
|
|
extern crate webpki;
|
|
|
|
#[cfg(feature = "rust-tls")]
|
|
|
|
extern crate webpki_roots;
|
|
|
|
|
|
|
|
use actix::Message;
|
|
|
|
|
2018-08-24 00:42:34 +02:00
|
|
|
/// re-export for convinience
|
|
|
|
pub use tower_service::{NewService, Service};
|
2018-08-22 02:08:23 +02:00
|
|
|
|
2018-08-19 19:47:04 +02:00
|
|
|
pub(crate) mod accept;
|
2018-08-24 07:12:10 +02:00
|
|
|
mod configurable;
|
|
|
|
mod connector;
|
2018-08-19 19:47:04 +02:00
|
|
|
mod server;
|
|
|
|
mod server_service;
|
|
|
|
pub mod service;
|
|
|
|
pub mod ssl;
|
|
|
|
mod worker;
|
|
|
|
|
2018-08-24 22:18:05 +02:00
|
|
|
pub use configurable::{NewConfigurableService, IntoNewConfigurableService};
|
2018-08-24 05:52:31 +02:00
|
|
|
pub use connector::{Connector, ConnectorError};
|
2018-08-22 06:11:16 +02:00
|
|
|
pub use server::Server;
|
2018-08-24 00:42:34 +02:00
|
|
|
pub use service::{IntoNewService, IntoService, NewServiceExt};
|
2018-08-19 19:47:04 +02:00
|
|
|
|
|
|
|
/// Pause accepting incoming connections
|
|
|
|
///
|
|
|
|
/// If socket contains some pending connection, they might be dropped.
|
|
|
|
/// All opened connection remains active.
|
|
|
|
#[derive(Message)]
|
|
|
|
pub struct PauseServer;
|
|
|
|
|
|
|
|
/// Resume accepting incoming connections
|
|
|
|
#[derive(Message)]
|
|
|
|
pub struct ResumeServer;
|
|
|
|
|
|
|
|
/// Stop incoming connection processing, stop all workers and exit.
|
|
|
|
///
|
|
|
|
/// If server starts with `spawn()` method, then spawned thread get terminated.
|
|
|
|
pub struct StopServer {
|
|
|
|
/// Whether to try and shut down gracefully
|
|
|
|
pub graceful: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Message for StopServer {
|
|
|
|
type Result = Result<(), ()>;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Socket id token
|
|
|
|
#[derive(Clone, Copy)]
|
2018-08-24 00:42:34 +02:00
|
|
|
pub(crate) struct Token(usize);
|