Added a function to access the tokio reactor handle in IrcReactor.

This commit is contained in:
Aaron Weiss 2018-01-27 15:18:15 +01:00
parent e62d4a97aa
commit 982d1b5a0d
No known key found for this signature in database
GPG key ID: 047D32DF25DC22EF

View file

@ -2,7 +2,7 @@
use futures::{Future, Stream};
use futures::future;
use tokio_core::reactor::Core;
use tokio_core::reactor::{Core, Handle};
use client::data::Config;
use client::server::{IrcServer, IrcServerFuture, Server};
@ -64,6 +64,13 @@ impl IrcReactor {
self.handlers.push(Box::new(future))
}
/// Returns a handle to the internal event loop. This is a sort of escape hatch that allows you
/// to take more control over what runs on the reactor using `tokio`. This can be used for
/// sharing this reactor with some elements of other libraries.
pub fn inner_handle(&self) -> Handle {
self.inner.handle()
}
/// Consumes all registered handlers and futures, and runs them. When using
/// `register_server_with_handler`, this will block indefinitely (until failure occurs) as it
/// will simply continue to process new, incoming messages for each server that was registered.