Fix race condition and support multiple socket connects before bind.