2018-08-21 21:11:16 -07:00
|
|
|
//! Actix net - framework for the compisible network services for Rust.
|
2018-08-19 10:47:04 -07:00
|
|
|
//!
|
|
|
|
//! ## Package feature
|
|
|
|
//!
|
|
|
|
//! * `tls` - enables ssl support via `native-tls` crate
|
2018-08-21 21:11:16 -07:00
|
|
|
//! * `ssl` - enables ssl support via `openssl` crate
|
2018-08-19 10:47:04 -07:00
|
|
|
//! * `rust-tls` - enables ssl support via `rustls` crate
|
|
|
|
//!
|
|
|
|
// #![warn(missing_docs)]
|
|
|
|
|
2018-09-07 14:34:31 -07:00
|
|
|
#![cfg_attr(
|
|
|
|
feature = "cargo-clippy",
|
|
|
|
allow(
|
|
|
|
declare_interior_mutable_const,
|
|
|
|
borrow_interior_mutable_const
|
|
|
|
)
|
|
|
|
)]
|
|
|
|
|
2018-08-19 10:47:04 -07:00
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
|
|
|
extern crate bytes;
|
2018-08-23 20:47:41 -07:00
|
|
|
#[macro_use]
|
2018-08-19 10:47:04 -07:00
|
|
|
extern crate failure;
|
|
|
|
extern crate futures;
|
|
|
|
extern crate mio;
|
|
|
|
extern crate net2;
|
|
|
|
extern crate num_cpus;
|
|
|
|
extern crate slab;
|
2018-08-23 20:47:41 -07:00
|
|
|
extern crate tokio;
|
2018-08-19 10:47:04 -07:00
|
|
|
extern crate tokio_io;
|
|
|
|
extern crate tokio_reactor;
|
|
|
|
extern crate tokio_tcp;
|
|
|
|
extern crate tokio_timer;
|
|
|
|
extern crate tower_service;
|
2018-08-23 20:47:41 -07:00
|
|
|
extern crate trust_dns_resolver;
|
2018-08-19 10:47:04 -07:00
|
|
|
|
2018-09-07 13:06:51 -07:00
|
|
|
#[allow(unused_imports)]
|
2018-09-04 12:42:06 -07:00
|
|
|
#[macro_use]
|
|
|
|
extern crate actix;
|
|
|
|
|
2018-08-19 10:47:04 -07:00
|
|
|
#[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-23 15:42:34 -07:00
|
|
|
/// re-export for convinience
|
|
|
|
pub use tower_service::{NewService, Service};
|
2018-08-21 17:08:23 -07:00
|
|
|
|
2018-08-19 10:47:04 -07:00
|
|
|
pub(crate) mod accept;
|
2018-08-28 22:28:13 -07:00
|
|
|
pub mod configurable;
|
2018-08-29 15:15:24 -07:00
|
|
|
pub mod connector;
|
2018-09-07 23:27:00 -07:00
|
|
|
pub mod server;
|
2018-08-19 10:47:04 -07:00
|
|
|
mod server_service;
|
|
|
|
pub mod service;
|
|
|
|
pub mod ssl;
|
2018-09-01 10:29:56 -07:00
|
|
|
pub mod stream;
|
2018-08-19 10:47:04 -07:00
|
|
|
mod worker;
|
|
|
|
|
2018-08-25 09:02:14 -07:00
|
|
|
pub use configurable::{IntoNewConfigurableService, NewConfigurableService};
|
2018-08-21 21:11:16 -07:00
|
|
|
pub use server::Server;
|
2018-09-04 09:49:21 -07:00
|
|
|
pub use service::{IntoNewService, IntoService, NewServiceExt, ServiceExt};
|
2018-08-19 10:47:04 -07: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-23 15:42:34 -07:00
|
|
|
pub(crate) struct Token(usize);
|