• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

oasisprotocol / oasis-core / #4588

07 Mar 2024 09:50AM UTC coverage: 44.999% (-0.02%) from 45.016%
#4588

push

web-flow
Merge pull request #5587 from oasisprotocol/ptrus/stable/23.0.x/go-1.21.8

[stable/23.0.x] go: update to 1.21.8

3 of 4 new or added lines in 2 files covered. (75.0%)

41 existing lines in 19 files now uncovered.

2857 of 6349 relevant lines covered (45.0%)

0.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/runtime/src/init.rs
1
//! Runtime initialization.
2
use std::sync::Arc;
3

4
use log;
5
use slog::{error, info};
6

7
use crate::{
8
    common::logger::{get_logger, init_logger},
9
    config::Config,
10
    dispatcher::{Dispatcher, Initializer},
11
    future::new_tokio_runtime,
12
    identity::Identity,
13
    protocol::{Protocol, Stream},
14
};
15

16
/// Starts the runtime.
17
pub fn start_runtime(initializer: Box<dyn Initializer>, config: Config) {
×
18
    // Initialize logging.
UNCOV
19
    init_logger(log::Level::Info);
×
20
    let logger = get_logger("runtime");
×
21
    info!(logger, "Runtime is starting");
×
22

23
    // Initialize runtime identity with runtime attestation key and runtime encryption key.
24
    let identity = Arc::new(Identity::new());
×
25

26
    // Initialize the async Tokio runtime.
27
    let tokio_runtime = new_tokio_runtime();
×
28
    let tokio_handle = tokio_runtime.handle();
×
29

30
    // Initialize the dispatcher.
31
    let dispatcher = Dispatcher::new(tokio_handle.clone(), initializer, identity.clone());
×
32

33
    info!(logger, "Establishing connection with the worker host");
×
34

35
    #[cfg(not(target_env = "sgx"))]
36
    let stream = match Stream::connect(std::env::var("OASIS_WORKER_HOST").unwrap_or_default()) {
×
37
        Err(error) => {
×
38
            error!(logger, "Failed to connect with the worker host"; "err" => %error);
×
39
            return;
40
        }
41
        Ok(stream) => stream,
×
42
    };
43

44
    #[cfg(target_env = "sgx")]
45
    let stream = match Stream::connect("worker-host") {
46
        Err(error) => {
47
            error!(logger, "Failed to connect with the worker host"; "err" => %error);
48
            return;
49
        }
50
        Ok(stream) => stream,
51
    };
52

53
    // Initialize the protocol handler loop.
54
    let protocol = Arc::new(Protocol::new(
×
55
        tokio_handle.clone(),
×
56
        stream,
×
57
        identity,
×
58
        dispatcher,
×
59
        config,
×
60
    ));
61

62
    // Start handling protocol messages. This blocks the main thread forever
63
    // (or until we get a shutdown request).
64
    protocol.start();
×
65

66
    info!(logger, "Protocol handler terminated, shutting down");
×
67
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc