diff --git a/.travis.yml b/.travis.yml index ed218383..b17d84a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,12 +32,12 @@ script: - | if [[ "$TRAVIS_RUST_VERSION" != "stable" ]]; then cargo clean - cargo test --features="ssl,tls,rust-tls" -- --nocapture + cargo test --features="ssl" -- --nocapture fi - | if [[ "$TRAVIS_RUST_VERSION" == "stable" ]]; then RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install -f cargo-tarpaulin - cargo tarpaulin --features="ssl,tls,rust-tls" --out Xml --no-count + cargo tarpaulin --features="ssl" --out Xml --no-count bash <(curl -s https://codecov.io/bash) echo "Uploaded code coverage" fi @@ -46,7 +46,7 @@ script: after_success: - | if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" = "false" && "$TRAVIS_BRANCH" == "master" && "$TRAVIS_RUST_VERSION" == "beta" ]]; then - cargo doc --features "ssl, tls, rust-tls, session" --no-deps && + cargo doc --features "ssl" --no-deps && echo "" > target/doc/index.html && git clone https://github.com/davisp/ghp-import.git && ./ghp-import/ghp_import.py -n -p -f -m "Documentation upload" -r https://"$GH_TOKEN"@github.com/"$TRAVIS_REPO_SLUG.git" target/doc && diff --git a/src/lib.rs b/src/lib.rs index f425f318..2666e252 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,47 +57,14 @@ extern crate webpki; #[cfg(feature = "rust-tls")] extern crate webpki_roots; -use actix::Message; - /// re-export for convinience pub use tower_service::{NewService, Service}; -pub(crate) mod accept; pub mod connector; pub mod resolver; pub mod server; -mod server_service; pub mod service; pub mod ssl; pub mod stream; -mod worker; -pub use server::Server; pub use service::{IntoNewService, IntoService, NewServiceExt, ServiceExt}; - -/// 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)] -pub(crate) struct Token(usize); diff --git a/src/accept.rs b/src/server/accept.rs similarity index 100% rename from src/accept.rs rename to src/server/accept.rs diff --git a/src/server/mod.rs b/src/server/mod.rs new file mode 100644 index 00000000..981afecb --- /dev/null +++ b/src/server/mod.rs @@ -0,0 +1,40 @@ +//! General purpose networking server + +use actix::Message; + +mod accept; +mod server; +mod services; +mod worker; + +pub use self::server::Server; +pub use self::services::ServerServiceFactory; + +pub(crate) use self::worker::Connections; + +/// 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)] +pub(crate) struct Token(usize); diff --git a/src/server.rs b/src/server/server.rs similarity index 99% rename from src/server.rs rename to src/server/server.rs index a968efa9..a031ad2d 100644 --- a/src/server.rs +++ b/src/server/server.rs @@ -11,10 +11,8 @@ use actix::{ Response, StreamHandler, System, WrapFuture, }; -pub use super::server_service::ServerServiceFactory; - use super::accept::{AcceptLoop, AcceptNotify, Command}; -use super::server_service::{InternalServerServiceFactory, ServerNewService}; +use super::services::{InternalServerServiceFactory, ServerNewService, ServerServiceFactory}; use super::worker::{self, Conn, StopWorker, Worker, WorkerAvailability, WorkerClient}; use super::{PauseServer, ResumeServer, StopServer, Token}; diff --git a/src/server_service.rs b/src/server/services.rs similarity index 98% rename from src/server_service.rs rename to src/server/services.rs index 0f197d82..b83459d4 100644 --- a/src/server_service.rs +++ b/src/server/services.rs @@ -5,7 +5,7 @@ use futures::{Future, Poll}; use tokio_reactor::Handle; use tokio_tcp::TcpStream; -use super::{NewService, Service}; +use {NewService, Service}; pub enum ServerMessage { Connect(net::TcpStream), diff --git a/src/worker.rs b/src/server/worker.rs similarity index 98% rename from src/worker.rs rename to src/server/worker.rs index 10354a26..889a2ac5 100644 --- a/src/worker.rs +++ b/src/server/worker.rs @@ -17,7 +17,7 @@ use actix::{ }; use super::accept::AcceptNotify; -use super::server_service::{BoxedServerService, InternalServerServiceFactory, ServerMessage}; +use super::services::{BoxedServerService, InternalServerServiceFactory, ServerMessage}; use super::Token; #[derive(Message)] diff --git a/src/ssl/mod.rs b/src/ssl/mod.rs index 0f16cd08..8d56a891 100644 --- a/src/ssl/mod.rs +++ b/src/ssl/mod.rs @@ -1,7 +1,7 @@ //! SSL Services use std::sync::atomic::{AtomicUsize, Ordering}; -use super::worker::Connections; +use super::server::Connections; #[cfg(feature = "ssl")] mod openssl;