That works a little better, but it's still inside the select() call, so if no other data has happened across the sockets, it will not get called anyway, right?
On Fri, Jan 17, 2014 at 4:50 PM, Sergey Lyubka <[email protected]> wrote: > The only thing I can think of is potential memory overflow. > mg_send_* functions do not actually send the data, they just buffer that > data in memory. Data is sent my mg_poll_server() if the socket is ready. > > If one has a huge chunk of data to send (e.g. big file), a memory overflow > may happen. Calling a handler on socket write is meant to solve this > problem, > but honestly, it doesn't guarantee that memory won't be overflown anyways. > > One solution to that is to call a handler on each poll iteration, as you > have > suggested. In addition, mongoose can expose a size of the "send" IO buffer, > allowing handler to control data flow. A handler may wait if the IO buffer > is getting to big, meaning that socket connection is too slow to sink the > data. > > Let's go with your suggestion. I've pushed > https://github.com/cesanta/mongoose/commit/40e5c744dac364081fabe265d632d84d281b493e > The other small change to export transmit buffer size is coming. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "mongoose-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/mongoose-users/0vxElWO7B5w/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/mongoose-users. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "mongoose-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mongoose-users. For more options, visit https://groups.google.com/groups/opt_out.
