mirror of
https://github.com/fafhrd91/actix-net
synced 2025-06-29 06:04:58 +02:00
move server impl to sub module
This commit is contained in:
33
src/lib.rs
33
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);
|
||||
|
40
src/server/mod.rs
Normal file
40
src/server/mod.rs
Normal file
@ -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);
|
@ -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};
|
||||
|
@ -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),
|
@ -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)]
|
@ -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;
|
||||
|
Reference in New Issue
Block a user