Struct apollo_framework::server::Server [−][src]
Represents a TODO server which manages all TCP connections.
Implementations
impl<P: 'static + Default + Send + Sync + Clone> Server<P>
[src]
impl<P: 'static + Default + Send + Sync + Clone> Server<P>
[src]pub fn install(platform: &Arc<Platform>) -> Arc<Self>
[src]
pub fn install(platform: &Arc<Platform>) -> Arc<Self>
[src]Creates and installs a Server into the given Platform.
Note that this is called by the Builder unless disabled.
Also note, that this will not technically start the server. This has to be done manually via event_loop as it is most probable done in the main thread.
pub fn connections(&self) -> Vec<ConnectionInfo<P>>
[src]
pub fn connections(&self) -> Vec<ConnectionInfo<P>>
[src]Lists all currently active connections.
pub fn fork<F>(
server: &Arc<Server<P>>,
client_loop: &'static impl Fn(Arc<Platform>, Arc<Connection<P>>, TcpStream) -> F + Send + Sync
) where
F: Future<Output = Result<()>> + Send + Sync,
[src]
pub fn fork<F>(
server: &Arc<Server<P>>,
client_loop: &'static impl Fn(Arc<Platform>, Arc<Connection<P>>, TcpStream) -> F + Send + Sync
) where
F: Future<Output = Result<()>> + Send + Sync,
[src]Starts the event loop in a separate thread.
This is most probably used by test scenarios where the tests itself run in the main thread.
pub async fn fork_and_await<F>(
server: &Arc<Server<P>>,
client_loop: &'static impl Fn(Arc<Platform>, Arc<Connection<P>>, TcpStream) -> F + Send + Sync
) where
F: Future<Output = Result<()>> + Send + Sync,
[src]
pub async fn fork_and_await<F>(
server: &Arc<Server<P>>,
client_loop: &'static impl Fn(Arc<Platform>, Arc<Connection<P>>, TcpStream) -> F + Send + Sync
) where
F: Future<Output = Result<()>> + Send + Sync,
[src]Starts the event loop in a separate thread and waits until the server is up and running.
Just like fork this is intended to be used in test environments.
pub async fn event_loop<F>(
&self,
client_loop: &'static impl Fn(Arc<Platform>, Arc<Connection<P>>, TcpStream) -> F + Send + Sync
) where
F: Future<Output = Result<()>> + Send + Sync,
[src]
pub async fn event_loop<F>(
&self,
client_loop: &'static impl Fn(Arc<Platform>, Arc<Connection<P>>, TcpStream) -> F + Send + Sync
) where
F: Future<Output = Result<()>> + Send + Sync,
[src]Tries to open a server socket on the specified address to serve incoming client connections.
The task of this loop is to bind the server socket to the specified address. Once this was successful, we enter the server_loop to actually handle incoming connections. Once this loop returns, either the platform is no longer running and we should exit, or the config has changed and we should try to bind the server to the new address.