diff --git a/core/posix.hh b/core/posix.hh index eb8a6a7686..433def40b4 100644 --- a/core/posix.hh +++ b/core/posix.hh @@ -196,6 +196,13 @@ public: auto r = ::bind(_fd, &sa, sl); throw_system_error_on(r == -1); } + void connect(sockaddr& sa, socklen_t sl) { + auto r = ::connect(_fd, &sa, sl); + if (r == -1 && errno == EINPROGRESS) { + return; + } + throw_system_error_on(r == -1); + } socket_address get_address() { socket_address addr; auto len = (socklen_t) sizeof(addr.u.sas);