Fixed connection leaks on errors
Ensured the worker process gets exited on timeouts
Added configurable socket options