[Libwebsockets] libuv loops

Joel Winarske joel.winarske at gmail.com
Sat Apr 15 03:44:38 CEST 2017


I think you're on to something.  I was freeing it right after calling the
right function.  I didn't check to see if it copies the buffers...  I
disabled the free to test and it was flushing the write about every seventh
incoming chunk.  Not what I consider acceptable, so I'm going without libuv.

Thanks!
Joel

On Fri, Apr 14, 2017 at 6:16 PM, Andy Green <andy at warmcat.com> wrote:

>
>
> On April 15, 2017 6:09:23 AM GMT+08:00, Joel Winarske <
> joel.winarske at gmail.com> wrote:
> >Hi Andy,
> >
> >It happens long before the close.  I have a large chunked file, and I
> >write
> >each incoming response to disk.  About three writes in, it blows up.
>
> The writes will be async in libuv, you maybe have to leave the buffers
> around until the libuv callback comes to say it's done (just guessing).
>
> >Ultimately I need to cache files to a temp directory.  If lws supported
> >fs
> >write(), nftw(), etc I would certainly use it.
>
> I'm not sure what the problem is... you can just add optional function
> ptrs to fops and fulfil them same way eg, read fops is done...
> lws-plat-unix.c has a read fops using posix, and lws-plat-win has a read
> fops using their crushed sealpup apis.  Write etc can be done the same way
> without libuv.
>
> -Andy
>
> >
> >Thanks!
> >Joel
> >
> >On Fri, Apr 14, 2017 at 2:18 PM, Andy Green <andy at warmcat.com> wrote:
> >
> >>
> >>
> >> On April 15, 2017 2:22:29 AM GMT+08:00, Joel Winarske <
> >> joel.winarske at gmail.com> wrote:
> >> >Hi Andy,
> >> >
> >> >I'm seeing some trouble with uv_fs calls.  I am using the wsi -
> >context
> >> >-
> >> >uv loop pointer.  A few of my writes work, then I get a pointer
> >> >exception
> >> >in libuv uv_process_async_wakeup_req().
> >> >
> >> >I don't see this problem with TCP I/O via the wsi - context - uv
> >loop
> >> >pointer.
> >> >
> >> >Should I be creating a separate loop for libuv file I/O?
> >>
> >> Not as far as I know.
> >>
> >> Close handling is tricky in libuv, that'd be the first suspect.  It
> >has to
> >> go through two stages and the libuv loop must run to callback the
> >handle
> >> close part... you have to call the right apis for the libuv type or
> >you
> >> blow up... this isn't an lws thing but a libuv thing.
> >>
> >> Since you are using platform fops, which has individual native plat
> >> implementations in lws, you can just not use libuv here in favour of
> >the
> >> native file apis; there was no libuv in the fops up to now.  Libuv is
> >good
> >> for when you only have one implementation, like the timers in the
> >> dumb-increment plugin, that you want to be cross-platform.
> >>
> >> -Andy
> >>
> >> >Thanks,
> >> >Joel
> >>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20170414/a496ab0e/attachment-0002.html>


More information about the Libwebsockets mailing list