-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Jaguar network-disabled. #465
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not entirely sure why I'm not super excited about this change. There are a lot of good stuff in here.
@@ -95,13 +95,13 @@ func RunCmd() *cobra.Command { | |||
"program runs on the current computer instead.\n" + | |||
"\n" + | |||
"The following define flags have a special meaning:\n" + | |||
" '-D jag.disabled': Disable Jaguar for this program.\n" + | |||
" Disables the HTTP server on the device.\n" + | |||
" '-D jag.network-disabled': Disable Jaguar for this program.\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the name of this define. Not entirely sure why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in person: the name isn't great.
- the network isn't really disabled.
- it's only affecting Jaguar which disables the http-based endpoint
- other containers are still free to use the network.
We still need to find a better name.
src/network.toit
Outdated
@@ -211,14 +211,16 @@ class EndpointHttp implements Endpoint: | |||
// Handle installing containers. | |||
else if path == "/install" and request.method == "PUT": | |||
container-name ::= headers.single HEADER-CONTAINER-NAME | |||
crc32 := int.parse (headers.single HEADER_CRC32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crc32 := int.parse (headers.single HEADER_CRC32) | |
crc32 := int.parse (headers.single HEADER-CRC32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
src/network.toit
Outdated
respond-ok writer | ||
|
||
// Handle code running. | ||
else if path == "/run" and request.method == "PUT": | ||
crc32 := int.parse (headers.single HEADER_CRC32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crc32 := int.parse (headers.single HEADER_CRC32) | |
crc32 := int.parse (headers.single HEADER-CRC32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
src/jaguar.toit
Outdated
// We start the container from a separate task to allow the server | ||
// to continue operating. This also means that the container running | ||
// isn't covered by the flashing mutex or associated timeout. | ||
task:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to go through some hoops to avoid this for installed containers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be better now.
src/jaguar.toit
Outdated
disabled / bool := false | ||
network-free / monitor.Semaphore ::= monitor.Semaphore | ||
container-done / monitor.Semaphore ::= monitor.Semaphore | ||
monitor NetworkManager: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should just be a wrapper around some state and a monitor.Signal
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
src/jaguar.toit
Outdated
network-is-disabled -> bool: | ||
return network-is-disabled_ | ||
|
||
start-network-endpoint -> none: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't really starting any network endpoints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to serve
taking an endpoint and device.
Co-authored-by: Kasper Lund <[email protected]>
No description provided.