diff options
Diffstat (limited to 'deps/uv/src/uv-common.c')
-rw-r--r-- | deps/uv/src/uv-common.c | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/deps/uv/src/uv-common.c b/deps/uv/src/uv-common.c index 0b05334945..ae2ca71474 100644 --- a/deps/uv/src/uv-common.c +++ b/deps/uv/src/uv-common.c @@ -197,44 +197,38 @@ int uv_ip6_name(struct sockaddr_in6* src, char* dst, size_t size) { int uv_tcp_bind(uv_tcp_t* handle, struct sockaddr_in addr) { - if (handle->type != UV_TCP || addr.sin_family != AF_INET) { - uv__set_artificial_error(handle->loop, UV_EINVAL); - return -1; - } - - return uv__tcp_bind(handle, addr); + if (handle->type != UV_TCP || addr.sin_family != AF_INET) + return uv__set_artificial_error(handle->loop, UV_EINVAL); + else + return uv__tcp_bind(handle, addr); } int uv_tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6 addr) { - if (handle->type != UV_TCP || addr.sin6_family != AF_INET6) { - uv__set_artificial_error(handle->loop, UV_EINVAL); - return -1; - } - - return uv__tcp_bind6(handle, addr); + if (handle->type != UV_TCP || addr.sin6_family != AF_INET6) + return uv__set_artificial_error(handle->loop, UV_EINVAL); + else + return uv__tcp_bind6(handle, addr); } -int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr, - unsigned int flags) { - if (handle->type != UV_UDP || addr.sin_family != AF_INET) { - uv__set_artificial_error(handle->loop, UV_EINVAL); - return -1; - } - - return uv__udp_bind(handle, addr, flags); +int uv_udp_bind(uv_udp_t* handle, + struct sockaddr_in addr, + unsigned int flags) { + if (handle->type != UV_UDP || addr.sin_family != AF_INET) + return uv__set_artificial_error(handle->loop, UV_EINVAL); + else + return uv__udp_bind(handle, addr, flags); } -int uv_udp_bind6(uv_udp_t* handle, struct sockaddr_in6 addr, - unsigned int flags) { - if (handle->type != UV_UDP || addr.sin6_family != AF_INET6) { - uv__set_artificial_error(handle->loop, UV_EINVAL); - return -1; - } - - return uv__udp_bind6(handle, addr, flags); +int uv_udp_bind6(uv_udp_t* handle, + struct sockaddr_in6 addr, + unsigned int flags) { + if (handle->type != UV_UDP || addr.sin6_family != AF_INET6) + return uv__set_artificial_error(handle->loop, UV_EINVAL); + else + return uv__udp_bind6(handle, addr, flags); } @@ -242,12 +236,10 @@ int uv_tcp_connect(uv_connect_t* req, uv_tcp_t* handle, struct sockaddr_in address, uv_connect_cb cb) { - if (handle->type != UV_TCP || address.sin_family != AF_INET) { - uv__set_artificial_error(handle->loop, UV_EINVAL); - return -1; - } - - return uv__tcp_connect(req, handle, address, cb); + if (handle->type != UV_TCP || address.sin_family != AF_INET) + return uv__set_artificial_error(handle->loop, UV_EINVAL); + else + return uv__tcp_connect(req, handle, address, cb); } @@ -255,12 +247,10 @@ int uv_tcp_connect6(uv_connect_t* req, uv_tcp_t* handle, struct sockaddr_in6 address, uv_connect_cb cb) { - if (handle->type != UV_TCP || address.sin6_family != AF_INET6) { - uv__set_artificial_error(handle->loop, UV_EINVAL); - return -1; - } - - return uv__tcp_connect6(req, handle, address, cb); + if (handle->type != UV_TCP || address.sin6_family != AF_INET6) + return uv__set_artificial_error(handle->loop, UV_EINVAL); + else + return uv__tcp_connect6(req, handle, address, cb); } |