Don't attempt to connect to master while initialization is in progress (for sentinel).
(cherry-picking f34fde22d8d from tanguylebarzic)
not sure if necessary
Allows a timeout on socket connection (for sentinel?)
(cherry-picking a2814025b from tanguylebarzic)
not sure if necessary