Graceful shutting down of MochiWeb?

Skip to first unread message

Vishal C

Jul 5, 2016, 10:54:31 AM7/5/16
to MochiWeb

I would like to shutdown MochiWeb as my application is shutting down. However, I do want MochiWeb to,
1. Try and finish all the pending request within the next few seconds (configurable) and then kill those processes if they still haven't completed.
2. Not accept any more new request.
Is there as straight foward way of doing this in Mochi?

thank a lot in advance and glad to be part of the group.


Bob Ippolito

Jul 5, 2016, 12:54:19 PM7/5/16
This is not functionality that mochiweb has built-in, but I don't think that it would be terribly hard to build. I'd be happy to accept any such pull requests, especially if it has tests!

If you decide to implement this, most of the functionality would involve mochiweb_socket_server. You would probably want to close the listen port, and then wait for active_sockets to go to 0 or a timeout is reached before terminating.

You received this message because you are subscribed to the Google Groups "MochiWeb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Vishal C

Jul 11, 2016, 4:12:31 PM7/11/16
to MochiWeb
I have created a new pull request for this..
When you get a chance can you please review it?
Reply all
Reply to author
0 new messages