wit-bindgen icon indicating copy to clipboard operation
wit-bindgen copied to clipboard

go: restore resource/stream/future handles on incomplete writes

Open dicej opened this issue 3 months ago • 0 comments

When a stream or future payload type includes (directly or indirectly) resource, stream, or future handles, writing such payloads involves lowering those handles into the canonical ABI representation with the intention of transferring ownership to the reader. That requires "taking" the handles from the Go object(s) being written, preventing those objects from being used after the write completes.

However, if the write is incomplete (e.g. because the reader only read a subset or dropped its end before reading anything), a subset of those handles must be returned to the objects from which they were taken. That allows the objects to be used again. Currently, the Go binding generator doesn't do this, so we (read: I) need to fix this.

dicej avatar Dec 08 '25 17:12 dicej