From 3e8fcf0b40f58ae588ea0e2712c4d111cd144900 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Fri, 30 Aug 2019 11:31:25 +0200 Subject: #915 do not bail out when failing to send message to stale clients Clients might enter power saving mode, hence, closing the connection with the server. When the server sends a request to refresh its state, if they are gone, do not break the iteration over the list of clients. --- sources/ogAdmServer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sources') diff --git a/sources/ogAdmServer.cpp b/sources/ogAdmServer.cpp index 1c78422..9e506b2 100644 --- a/sources/ogAdmServer.cpp +++ b/sources/ogAdmServer.cpp @@ -1141,10 +1141,9 @@ static bool og_send_cmd(char *ips_array[], int ips_array_len, int sock = tbsockets[idx].cli ? tbsockets[idx].cli->io.fd : -1; strcpy(tbsockets[idx].estado, state); // Actualiza el estado del cliente - if (!mandaTrama(&sock, ptrTrama)) { + if (sock >= 0 && !mandaTrama(&sock, ptrTrama)) { syslog(LOG_ERR, "failed to send response to %s:%s\n", ips_array[i], strerror(errno)); - return false; } } } @@ -3141,10 +3140,9 @@ static bool envioProgramacion(TRAMA *ptrTrama, struct og_client *cli) int sock = tbsockets[idx].cli ? tbsockets[idx].cli->io.fd : -1; strcpy(tbsockets[idx].estado, CLIENTE_OCUPADO); // Actualiza el estado del cliente - if (!mandaTrama(&sock, ptrTrama)) { + if (sock >= 0 && !mandaTrama(&sock, ptrTrama)) { syslog(LOG_ERR, "failed to send response: %s\n", strerror(errno)); - return false; } //close(tbsockets[idx].sock); // Cierra el socket del cliente hasta nueva disponibilidad } -- cgit v1.2.3-18-g5258