Add support for systemd watchdog protocol
Systemd provides a watchdog protocol, as described on http://0pointer.de/blog/projects/watchdog.html . It basically requires the service to write a message to a socket every X second, if some environment variables are set. While present since a long time, the newer v209 version provides a helper function to implement it, by moving the parsing logic in a library.
So here is 2 patches for tor :
The first one implement the Notify protocol for systemd, thus permitting people to use Type=notify in the systemd unit ( see http://www.freedesktop.org/software/systemd/man/systemd.service.html for the detail, as well as the rather lengthy debate on Debian init system for Jessie ). The patch is not doing much or adding much features, but I guess some people would prefer to have this Type of systemd unit rather than simple as it could prevent some race condition if a service requires tor to be really started and working, before being started himself. It also add status line to systemd, but that's not a feature that is currently used much ( I do hope maybe some higher level tool like cockpit would use it later ).
The 2nd one is adding a event to the main loop to ping the watchdog on a regular basis, using the new function in libsystemd-daemon. So this way, if tor is stuck, it will be restarted. I guess I do not have to explain how and why this improve tor :)
So far, I only have been able to test the first one on my Fedora 20 and I am waiting for package to test the 2nd one in real life. However, in order to release early, release often, I upload them here for review.
Trac:
Username: misc