mirror of https://github.com/fafhrd91/actix-net
remove new indirection
This commit is contained in:
parent
13bc72a71e
commit
f10a4e739e
|
@ -147,7 +147,7 @@ impl Arbiter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets up an Arbiter runner on the current thread using the provided runtime local task set.
|
/// Sets up an Arbiter runner on the current thread using the provided runtime local task set.
|
||||||
pub(crate) fn new_current_thread(local: &LocalSet) -> ArbiterHandle {
|
pub(crate) fn in_new_system(local: &LocalSet) -> ArbiterHandle {
|
||||||
let (tx, rx) = mpsc::unbounded_channel();
|
let (tx, rx) = mpsc::unbounded_channel();
|
||||||
|
|
||||||
let hnd = ArbiterHandle::new(tx);
|
let hnd = ArbiterHandle::new(tx);
|
||||||
|
|
|
@ -36,15 +36,11 @@ impl System {
|
||||||
/// Panics if underlying Tokio runtime can not be created.
|
/// Panics if underlying Tokio runtime can not be created.
|
||||||
#[allow(clippy::new_ret_no_self)]
|
#[allow(clippy::new_ret_no_self)]
|
||||||
pub fn new() -> SystemRunner {
|
pub fn new() -> SystemRunner {
|
||||||
Self::create_runtime()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_runtime() -> SystemRunner {
|
|
||||||
let (stop_tx, stop_rx) = oneshot::channel();
|
let (stop_tx, stop_rx) = oneshot::channel();
|
||||||
let (sys_tx, sys_rx) = mpsc::unbounded_channel();
|
let (sys_tx, sys_rx) = mpsc::unbounded_channel();
|
||||||
|
|
||||||
let rt = Runtime::new().expect("Actix (Tokio) runtime could not be created.");
|
let rt = Runtime::new().expect("Actix (Tokio) runtime could not be created.");
|
||||||
let system = System::construct(sys_tx, Arbiter::new_current_thread(rt.local_set()));
|
let system = System::construct(sys_tx, Arbiter::in_new_system(rt.local_set()));
|
||||||
|
|
||||||
// init background system arbiter
|
// init background system arbiter
|
||||||
let sys_ctrl = SystemController::new(sys_rx, stop_tx);
|
let sys_ctrl = SystemController::new(sys_rx, stop_tx);
|
||||||
|
|
Loading…
Reference in New Issue