Added graceful shutdown and deadline for pings.
Added SIGINT/SIGKILL handling.