Chris encouraged me by telling me what Erlang function to call (couch_httpd:stop). I got it working today, and it’s pretty much instantaneous. I also put in a check that only restarts on wake if the listener socket isn’t responding anymore. In the bit of testing I’ve done, the restart isn’t even necessary if the app hasn’t been evicted from RAM and the device hasn’t been put to sleep; so if you leave the app and go into another app for a few minutes and then come back, everything is still running when you return and nothing needs to be done.
This fix is now available in the latest ‘nightly’ build: