Repository navigation
Conversation
| impl wasmtime_wasi::p2::OutputStream for CustomOutputStream { | ||
| fn write(&mut self, bytes: Bytes) -> Result<(), StreamError> { | ||
| // Keep in sync with the permit reported by `check_write` below. | ||
| const WRITE_BUDGET: usize = 64 * 1024; |
There was a problem hiding this comment.
this const should be hoisted out to the parent scope, and used in the check_write method as well
| } | ||
| } | ||
|
|
||
| enum StdioOutputStream { |
There was a problem hiding this comment.
I don't think that it is worthwhile for us to track whether check_write has issued the permit, we just need to trap when write exceeds the permitted size, which it already does. So, all of these changes to the cli streams should be thrown away - they already obey the spec from my reading as well as what we enforce in other streams.
|
This PR is borderline on my radar of needing more careful human review before submission - the changes to c-api and pipe are fundamentally completely different to those proposed in the changes to the stdout/stderr streams, and it would have been nice if you had caught that before submitting. |
The c-api, sink and file streams accepted writes larger than the check-write budget; reject them and share one budget constant.
25c1fa9 to
baa508b
Compare
|
Noted. |
Dropped the cli tracking. The c-api, sink and file streams now trap when a write exceeds the check-write permit, with one shared budget.