diff --git a/lib/socket.c b/lib/socket.c index 04fd56bd1..92c7027c5 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -798,23 +798,23 @@ void dummy_socket(socket_t *r, const sockaddr_t *sa) { r->remote.address.family = sa->family; } -int connect_socket(socket_t *r, int type, const endpoint_t *ep) { +bool connect_socket(socket_t *r, int type, const endpoint_t *ep) { sockfamily_t *fam; fam = ep->address.family; if (__socket(r, type, fam)) - return -1; + return false; if (fam->connect(r, ep)) goto fail; r->remote = *ep; - return 0; + return true; fail: close_socket(r); - return -1; + return false; } int connect_socket_retry(socket_t *r) { @@ -847,15 +847,15 @@ int connect_socket_nb(socket_t *r, int type, const endpoint_t *ep) { return connect_socket_retry(r); } -int reset_socket(socket_t *r) { +bool reset_socket(socket_t *r) { if (!r) - return -1; + return false; r->fd = -1; ZERO(r->local); ZERO(r->remote); - return 0; + return true; } int close_socket(socket_t *r) { if (!r) { diff --git a/lib/socket.h b/lib/socket.h index b0d7f0758..bbd08683f 100644 --- a/lib/socket.h +++ b/lib/socket.h @@ -276,11 +276,11 @@ void socket_init(void); bool open_socket(socket_t *r, int type, unsigned int port, const sockaddr_t *); bool open_v46_socket(socket_t *r, int type); -int connect_socket(socket_t *r, int type, const endpoint_t *ep); +bool connect_socket(socket_t *r, int type, const endpoint_t *ep); int connect_socket_nb(socket_t *r, int type, const endpoint_t *ep); // 1 == in progress int connect_socket_retry(socket_t *r); // retries connect() while in progress int close_socket(socket_t *r); -int reset_socket(socket_t *r); +bool reset_socket(socket_t *r); void move_socket(socket_t *dst, socket_t *src); void dummy_socket(socket_t *r, const sockaddr_t *);