Package proc allows you to configure servers to be restarted with negligible downtime.
Listen tries to create a listener on the specified tcp port. Before creating the listener, it checks to see if there is another server already using the port. If there is one, it sends a USR1 signal requesting the server to shutdown, and then attempts to to create the listener.
ListenAndServe combines Listen and Wait to also run an http server on the specified port. If it fails to obtain a listener, the program is fatally terminated. The return value is the signal received for termination
Published creates a wrapper for net.Listener that publishes connection stats.
Wait creates an HTTP handler on pidURL, and serves the current process pid on it. It then creates a signal handler and waits for SIGTERM or SIGUSR1, and returns when the signal is received. A new server that comes up will query this URL. If it receives a valid response, it will send a SIGUSR1 signal and attempt to bind to the port the current server is using.
Accept increments stats counters before returning a connection.