Skip to content

Conversation

@cyqsimon
Copy link
Collaborator

@cyqsimon cyqsimon commented Oct 21, 2023

Synopsis

OSInputOutput definition changed from:

pub struct OsInputOutput {
    pub network_interfaces: Vec<NetworkInterface>,
    pub network_frames: Vec<Box<dyn DataLinkReceiver>>,
    pub get_open_sockets: fn() -> OpenSockets,
    pub terminal_events: Box<dyn Iterator<Item = Event> + Send>,
    pub dns_client: Option<dns::Client>,
    pub write_to_stdout: Box<dyn FnMut(String) + Send>,
}

to:

pub struct OsInputOutput {
    pub interfaces_with_frames: Vec<(NetworkInterface, Box<dyn DataLinkReceiver>)>,
    pub get_open_sockets: fn() -> OpenSockets,
    pub terminal_events: Box<dyn Iterator<Item = Event> + Send>,
    pub dns_client: Option<dns::Client>,
    pub write_to_stdout: Box<dyn FnMut(String) + Send>,
}

This is to provide stronger semantic safeguards against accidental & unnoticed screwups.


Unresolved issues

  • This refactor seems to have changed test outputs substantively, when it really shouldn't have changed anything. This needs to be investigated before merge. Okay clearly not. That seems to be due to another commit on my local branch. This is good to merge then, seeing that the test failures are no worse than they were.

@cyqsimon cyqsimon merged commit 6fa77d2 into main Oct 21, 2023
@cyqsimon cyqsimon deleted the os-input-output-refactor branch October 21, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants