Improved signal safe connect.
Fixed a race condition in listener socket.