<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 4, 2013 at 8:29 AM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<div><div class="h5"><br>
On Tue, Jun 04, 2013 at 12:23:33AM -0600, Julien Zefi wrote:<br>
<br>
> On Sun, Jun 2, 2013 at 8:29 PM, Julien Zefi <<a href="mailto:jzefip@gmail.com">jzefip@gmail.com</a>> wrote:<br>
><br>
> > hi,<br>
> ><br>
> > i am writing a module that creates and returns large amount of data,<br>
> > obviously this is blocking the worker but my main function that create the<br>
> > data can be called many times to get the result by parts.<br>
> ><br>
> > I cannot find what's the right way to setup my handler, the intention is<br>
> > to invoke my function many times as required and send out the results by<br>
> > chunks, whats the best approach ?<br>
<br>
</div></div>I would recommend to set r->write_event_handler, and use<br>
ngx_add_timer() with 1ms timeout to schedule another call to your<br>
handler.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><br></div><div class="gmail_quote">hi Maxim, <br><br></div><div class="gmail_quote">thanks for your response. Why a timer is required ?, my expectation is that my function be called when the client socket is ready for write again. My function is encoding video packets so i expect this:<br>
<br></div><div class="gmail_quote">  1. initial handler called, setup the write event callback<br></div><div class="gmail_quote">  2. once the client socket is ready for write, invoke my write_event callback<br></div><div class="gmail_quote">
  3. write the packet<br></div><div class="gmail_quote">  4. repeat #2 and #3 until the callback decide to finish the request<br><br></div><div class="gmail_quote">is that possible ?<br><br></div><div class="gmail_quote">
J.Z.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div></div></div>