On Tue, Jun 24, 2014 at 5:19 PM, Terence Martin <[email protected]> wrote:
> Not a bug, but possibly a missing addendum to the documentation. > > The docs say that MG_CLOSE is invoked when the connection is being closed. > However, in error situations (e.g. when MG_HTTP_ERROR is invoked), once the > response is sent out the connection is closed but MG_CLOSE is not invoked. > > Not a big deal because this seems to only happen when you tell Mongoose to > handle the request itself. However if you put something in connection_param > before you did that, the documentation leads you to believe that you can > use MG_CLOSE to clean it up, which doesn't seem to be the case. > Good observation, I think it would be consistent to send MG_CLOSE in all cases, even in case of MG_HTTP_ERROR case. Will push a fix soon. Also, just as an aside, is there a good reason to not have a way for the > handling code to indicate that it thinks the connection should be closed? > For example if you were waiting for a database transaction to finish and > you decided that it would be better to time out the connection early and > close it rather than keep waiting. I know you can change what the idle > timeout value is, but that is then for every request. > > I guess you could also have MG_POLL return TRUE, but then you're at the > mercy of the polling interval of the server. > Polling interval is set by the user, in mg_poll_server(). My guess is that setting some reasonable granularity (e.g. 100-200ms) is a way to go in that situations. connection_param can keep the time it is idle and time-out when necessary. -- 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/d/optout.
