Set all select timeouts to 2sec and add proper socket shutdown.