MT#55283 convert close_socket to bool

Change-Id: I290012391ba1fa2c6c550614e054181de6e0b94e
pull/1910/head
Richard Fuchs 12 months ago
parent 050cdd3ae1
commit 7599e5c375

@ -1094,7 +1094,7 @@ static void release_port_now(socket_t *r, ports_q *list, struct port_pool *pp) {
__C_DBG("Trying to release the port '%u'", port); __C_DBG("Trying to release the port '%u'", port);
if (close_socket(r) == 0) { if (close_socket(r)) {
__C_DBG("A socket for the '%u' has been closed", port); __C_DBG("A socket for the '%u' has been closed", port);
iptables_del_rule(r); iptables_del_rule(r);

@ -857,26 +857,26 @@ bool reset_socket(socket_t *r) {
return true; return true;
} }
int close_socket(socket_t *r) { bool close_socket(socket_t *r) {
if (!r) { if (!r) {
__C_DBG("close() syscall not called, no socket"); __C_DBG("close() syscall not called, no socket");
return -1; return false;
} }
if (r->fd == -1) { if (r->fd == -1) {
__C_DBG("close() syscall not called, fd=%d", r->fd); __C_DBG("close() syscall not called, fd=%d", r->fd);
return -1; return false;
} }
if (close(r->fd) != 0) { if (close(r->fd) != 0) {
__C_DBG("close() syscall fail, fd=%d", r->fd); __C_DBG("close() syscall fail, fd=%d", r->fd);
return -1; return false;
} }
__C_DBG("close() syscall success, fd=%d", r->fd); __C_DBG("close() syscall success, fd=%d", r->fd);
reset_socket(r); reset_socket(r);
return 0; return true;
} }
// moves the contents of the socket object: // moves the contents of the socket object:

@ -279,7 +279,7 @@ bool open_v46_socket(socket_t *r, int type);
bool 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_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 connect_socket_retry(socket_t *r); // retries connect() while in progress
int close_socket(socket_t *r); bool close_socket(socket_t *r);
bool reset_socket(socket_t *r); bool reset_socket(socket_t *r);
void move_socket(socket_t *dst, socket_t *src); void move_socket(socket_t *dst, socket_t *src);
void dummy_socket(socket_t *r, const sockaddr_t *); void dummy_socket(socket_t *r, const sockaddr_t *);

Loading…
Cancel
Save