summaryrefslogtreecommitdiffstats
path: root/sources/ogAdmServer.cpp
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2019-08-30 11:31:25 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-09-02 13:36:50 +0200
commit3e8fcf0b40f58ae588ea0e2712c4d111cd144900 (patch)
tree9ecb39c3eadab480e6ab2df042fdda3672333786 /sources/ogAdmServer.cpp
parent3de93a9503b8dc7e20345bc1d7838ba50c56bfa7 (diff)
#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.
Diffstat (limited to 'sources/ogAdmServer.cpp')
-rw-r--r--sources/ogAdmServer.cpp6
1 files changed, 2 insertions, 4 deletions
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
}