diff options
author | ptlomholt <pt@lomholt.com> | 2019-01-17 11:05:35 -0800 |
---|---|---|
committer | Santiago Gimeno <santiago.gimeno@gmail.com> | 2019-02-05 08:50:05 +0100 |
commit | 110eb817bdb2e5f14e08a2afbca42146291251a8 (patch) | |
tree | 5ed3619559f46462752bfcdd71f3fcbb6f61917e | |
parent | f66eda7cbaf6a1bec86bbaf3928d5319956ac975 (diff) | |
download | libuv-110eb817bdb2e5f14e08a2afbca42146291251a8.tar.gz libuv-110eb817bdb2e5f14e08a2afbca42146291251a8.zip |
openbsd,tcp: special handling of EINVAL on connect
Map `EINVAL` to `ECONNREFUSED` and return error on the next tick.
Fixes: https://github.com/libuv/libuv/issues/2155
PR-URL: https://github.com/libuv/libuv/pull/2154
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
-rw-r--r-- | src/unix/tcp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/unix/tcp.c b/src/unix/tcp.c index 2982851d..900839a9 100644 --- a/src/unix/tcp.c +++ b/src/unix/tcp.c @@ -235,12 +235,16 @@ int uv__tcp_connect(uv_connect_t* req, if (r == -1 && errno != 0) { if (errno == EINPROGRESS) ; /* not an error */ - else if (errno == ECONNREFUSED) - /* If we get a ECONNREFUSED wait until the next tick to report the - * error. Solaris wants to report immediately--other unixes want to - * wait. + else if (errno == ECONNREFUSED +#if defined(__OpenBSD__) + || errno == EINVAL +#endif + ) + /* If we get ECONNREFUSED (Solaris) or EINVAL (OpenBSD) wait until the + * next tick to report the error. Solaris and OpenBSD wants to report + * immediately -- other unixes want to wait. */ - handle->delayed_error = UV__ERR(errno); + handle->delayed_error = UV__ERR(ECONNREFUSED); else return UV__ERR(errno); } |