go-capnp
go-capnp copied to clipboard
WIP: simplify transport.
A substantial amount of the complexity of the transport package is due the interface: we pass contexts to functions that do IO, and then jump through hoops to respect those contexts. Instead, this patch changes Transport and Codec's Close() to work like net.Close(): it interrupts any outstanding IO. We demand the same semantics from the io.ReadWriteCloser that we pass in, which seems like not a tall order.
Still TODO:
- [ ] rework the rpc subsystem's shutdown logic. The basic idea is we spawn an extra goroutine to wait on context.Done() and then call close, but the shutdown logic is intricate and I am too tired right now; this patch introduces test regressions for now.
- [ ] Tweak the docs on how this changes the interface for e.g. NewConn
Marking this as a draft for now, until I find time to tie up the loose ends.