summaryrefslogtreecommitdiffhomepage
path: root/mullvad-rpc/src/event_loop.rs
blob: ea93de249310d853cb0e769fc512e79d547e4465 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use tokio::runtime::{Builder, Runtime};

/// Creates a new tokio runtime to be exclusively used for HTTP requests.
// FIXME: Remove this once the daemon has migrated.
pub fn create_runtime() -> Result<Runtime, crate::Error> {
    let runtime = Builder::new()
        .threaded_scheduler()
        .core_threads(2)
        .enable_all()
        .thread_name("mullvad-rpc-event-loop")
        .build();

    runtime.map_err(crate::Error::TokioRuntimeError)
}