Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread Vitali Lovich
On Mon, Jul 6, 2020 at 8:34 AM Kenton Varda wrote: > On Mon, Jul 6, 2020 at 10:22 AM Vitali Lovich wrote: > >> I don't feel great about the duplication approach (or allowing retrieving >> the raw handle directly) as it can be subtly tricky to actually use >> correctly. For example, if you dup &

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread 'Kenton Varda' via Cap'n Proto
On Mon, Jul 6, 2020 at 10:22 AM Vitali Lovich wrote: > I don't feel great about the duplication approach (or allowing retrieving > the raw handle directly) as it can be subtly tricky to actually use > correctly. For example, if you dup & make the dup'ed FD blocking, that will > impact correct beh

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread Vitali Lovich
On Mon, Jul 6, 2020 at 8:13 AM Kenton Varda wrote: > On Mon, Jul 6, 2020 at 9:28 AM Vitali Lovich wrote: > >> Yeah, that's what I figured. The KJ API is s much more user friendly though :). It would be cool to be able to consume the raw file descriptor/socket out of the pipes the

Re: [capnproto] Easiest way to connect two kj::AsyncIoStream?

2020-07-06 Thread Vitali Lovich
On Mon, Jul 6, 2020 at 7:41 AM Vitali Lovich wrote: > > On Mon, Jul 6, 2020 at 7:26 AM Kenton Varda wrote: > >> Almost. Two issues I can think of: >> >> 1. After each pump completes, you probably want to call shutdownWrite() >> to propagate the EOF. >> 2. `joinPromises()` always waits for all pr

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread 'Kenton Varda' via Cap'n Proto
On Mon, Jul 6, 2020 at 9:28 AM Vitali Lovich wrote: > Yeah, that's what I figured. The KJ API is s much more user friendly >>> though :). It would be cool to be able to consume the raw file >>> descriptor/socket out of the pipes the LowlevelIoProvider constructs to >>> simplify code/error ha

Re: [capnproto] Easiest way to connect two kj::AsyncIoStream?

2020-07-06 Thread Vitali Lovich
On Mon, Jul 6, 2020 at 7:26 AM Kenton Varda wrote: > Almost. Two issues I can think of: > > 1. After each pump completes, you probably want to call shutdownWrite() to > propagate the EOF. > 2. `joinPromises()` always waits for all promises to resolve. I've often > found that this turns out to be

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread Vitali Lovich
On Mon, Jul 6, 2020 at 7:14 AM Kenton Varda wrote: > On Mon, Jul 6, 2020 at 8:02 AM Vitali Lovich wrote: > >> On Sun, Jul 5, 2020 at 3:02 PM Kenton Varda >> wrote: >> >>> On Sun, Jul 5, 2020 at 1:48 PM Vitali Lovich wrote: >>> Yeah, so I'm still working through getting executeSync working

Re: [capnproto] Easiest way to connect two kj::AsyncIoStream?

2020-07-06 Thread 'Kenton Varda' via Cap'n Proto
Almost. Two issues I can think of: 1. After each pump completes, you probably want to call shutdownWrite() to propagate the EOF. 2. `joinPromises()` always waits for all promises to resolve. I've often found that this turns out to be the wrong behavior when one of the joined promises throws an exc

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread 'Kenton Varda' via Cap'n Proto
On Mon, Jul 6, 2020 at 8:02 AM Vitali Lovich wrote: > On Sun, Jul 5, 2020 at 3:02 PM Kenton Varda wrote: > >> On Sun, Jul 5, 2020 at 1:48 PM Vitali Lovich wrote: >> >>> Yeah, so I'm still working through getting executeSync working. I do >>> wish executeAsync would still be able to do the right

Re: [capnproto] Integrating KJ with other systems

2020-07-06 Thread Vitali Lovich
On Sun, Jul 5, 2020 at 3:02 PM Kenton Varda wrote: > On Sun, Jul 5, 2020 at 1:48 PM Vitali Lovich wrote: > >> Yeah, so I'm still working through getting executeSync working. I do wish >> executeAsync would still be able to do the right thing when invoked from >> off-thread to avoid creating arti