Browse Source

MT#55283 convert reset_socket to bool

Change-Id: I8f59d0d44186a0e41f2a044b24f2bf13714ebf16
pull/1910/head
Richard Fuchs 10 months ago
parent
commit
0a034ecde2
2 changed files with 9 additions and 9 deletions
  1. +7
    -7
      lib/socket.c
  2. +2
    -2
      lib/socket.h

+ 7
- 7
lib/socket.c View File

@ -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) {


+ 2
- 2
lib/socket.h View File

@ -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 *);


Loading…
Cancel
Save