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 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.
