diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2019-08-30 11:31:25 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2019-09-02 13:36:50 +0200 |
commit | 0deba6314348531e4f793289e4e7dfe5d84055fb (patch) | |
tree | 0c54f0f1d797d8ef6022f65787123bb506d10c7c | |
parent | 7208cc929e96cc01b3b64b6667f921abdf493513 (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.
-rw-r--r-- | admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp index 1c784227..9e506b22 100644 --- a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp +++ b/admin/Sources/Services/ogAdmServer/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 } |