summaryrefslogtreecommitdiff
path: root/src/analysis/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/db')
-rw-r--r--src/analysis/db/client.c52
1 files changed, 37 insertions, 15 deletions
diff --git a/src/analysis/db/client.c b/src/analysis/db/client.c
index 329d57d..3197a8c 100644
--- a/src/analysis/db/client.c
+++ b/src/analysis/db/client.c
@@ -900,12 +900,18 @@ SSL *g_hub_client_get_ssl_fd(GHubClient *client)
result = client->tls_fd;
+ if (result == NULL)
+ g_mutex_unlock(&client->sending_lock);
+
+ else
+ {
#ifndef NDEBUG
- ret = SSL_up_ref(result);
- assert(ret == 1);
+ ret = SSL_up_ref(result);
+ assert(ret == 1);
#else
- SSL_up_ref(result);
+ SSL_up_ref(result);
#endif
+ }
return result;
@@ -950,17 +956,25 @@ bool g_hub_client_save(GHubClient *client)
{
bool result; /* Bilan partiel à remonter */
packed_buffer out_pbuf; /* Tampon d'émission */
+ SSL *tls_fd; /* Canal de communication SSL */
init_packed_buffer(&out_pbuf);
- g_hub_client_get_ssl_fd(client);
+ tls_fd = g_hub_client_get_ssl_fd(client);
- result = extend_packed_buffer(&out_pbuf, (uint32_t []) { DBC_SAVE }, sizeof(uint32_t), true);
+ if (tls_fd == NULL)
+ result = false;
- if (result)
- result = ssl_send_packed_buffer(&out_pbuf, client->tls_fd);
+ else
+ {
+ result = extend_packed_buffer(&out_pbuf, (uint32_t []) { DBC_SAVE }, sizeof(uint32_t), true);
+
+ if (result)
+ result = ssl_send_packed_buffer(&out_pbuf, tls_fd);
- g_hub_client_put_ssl_fd(client, client->tls_fd);
+ g_hub_client_put_ssl_fd(client, tls_fd);
+
+ }
exit_packed_buffer(&out_pbuf);
@@ -986,20 +1000,28 @@ bool g_hub_client_set_last_active(GHubClient *client, timestamp_t timestamp)
{
bool result; /* Bilan partiel à remonter */
packed_buffer out_pbuf; /* Tampon d'émission */
+ SSL *tls_fd; /* Canal de communication SSL */
init_packed_buffer(&out_pbuf);
- g_hub_client_get_ssl_fd(client);
+ tls_fd = g_hub_client_get_ssl_fd(client);
+
+ if (tls_fd == NULL)
+ result = false;
- result = extend_packed_buffer(&out_pbuf, (uint32_t []) { DBC_SET_LAST_ACTIVE }, sizeof(uint32_t), true);
+ else
+ {
+ result = extend_packed_buffer(&out_pbuf, (uint32_t []) { DBC_SET_LAST_ACTIVE }, sizeof(uint32_t), true);
- if (result)
- result = pack_timestamp(&timestamp, &out_pbuf);
+ if (result)
+ result = pack_timestamp(&timestamp, &out_pbuf);
- if (result)
- result = ssl_send_packed_buffer(&out_pbuf, client->tls_fd);
+ if (result)
+ result = ssl_send_packed_buffer(&out_pbuf, tls_fd);
- g_hub_client_put_ssl_fd(client, client->tls_fd);
+ g_hub_client_put_ssl_fd(client, tls_fd);
+
+ }
exit_packed_buffer(&out_pbuf);