Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

sandbox: refactor to integrate new network stack #180

Merged
merged 14 commits into from
Jul 25, 2023

Conversation

achille-roussel
Copy link
Contributor

Still a work in progress as I have a few tests that are disabled but the big chunk of the work is done.

The PR integrates the first pass I took in the internal/network package into internal/sandbox; as a reminder, the intent here is to create a virtual network between processes spawned by timecraft so they can connect.

I moved all the files into internal/sandbox, getting rid of the internal/network package because there were too many platform-specific dependencies in both that felt like implicit dependencies between the source files, keeping them together seemed like a better approach.

One key change is I ended implementing blocking mode in the sockets: when used in blocking mode, the sockets duplicate their file descriptors and create an *os.File with the dup fd. The *os.File is used to interact with the Go net poller: when blocking operations are performed, it uses syscall.RawConn to block the goroutine on I/O, preventing the creation of threads if the guest modules were blocking on a syscalls (e.g. accept/connect/recv/send).

internal/sandbox/system.go Outdated Show resolved Hide resolved
internal/sandbox/system.go Outdated Show resolved Hide resolved
Signed-off-by: Achille Roussel <[email protected]>
Signed-off-by: Achille Roussel <[email protected]>
Signed-off-by: Achille Roussel <[email protected]>
Signed-off-by: Achille Roussel <[email protected]>
Signed-off-by: Achille Roussel <[email protected]>
Signed-off-by: Achille Roussel <[email protected]>
Signed-off-by: Achille Roussel <[email protected]>
Signed-off-by: Achille Roussel <[email protected]>
Signed-off-by: Achille Roussel <[email protected]>
@achille-roussel achille-roussel merged commit 7e0da51 into main Jul 25, 2023
5 checks passed
@achille-roussel achille-roussel deleted the sandbox-refactor branch July 25, 2023 05:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants