summaryrefslogtreecommitdiff
path: root/src/analysis/db/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/db/client.c')
-rw-r--r--src/analysis/db/client.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/analysis/db/client.c b/src/analysis/db/client.c
index 4b807ae..71df99c 100644
--- a/src/analysis/db/client.c
+++ b/src/analysis/db/client.c
@@ -328,6 +328,7 @@ static void *g_db_client_update(GDbClient *client)
uint32_t val32; /* Valeur sur 32 bits */
bool status; /* Bilan d'une opération */
uint32_t command; /* Commande de la requête */
+ DBError error; /* Bilan d'une commande passée */
GDbCollection *collec; /* Collection visée au final */
fds.fd = client->fd;
@@ -353,6 +354,19 @@ static void *g_db_client_update(GDbClient *client)
switch (command)
{
+ case DBC_SAVE:
+
+ status = safe_recv(fds.fd, &val32, sizeof(uint32_t), 0);
+ if (!status) goto gdcu_bad_exchange;
+
+ error = be32toh(val32);
+
+ printf("## CLIENT ## Saved ? %d\n", error);
+
+
+
+ break;
+
case DBC_COLLECTION:
status = safe_recv(fds.fd, &val32, sizeof(uint32_t), 0);
@@ -361,7 +375,7 @@ static void *g_db_client_update(GDbClient *client)
collec = find_collection_in_list(client->collections, be32toh(val32));
if (collec == NULL) goto gdcu_bad_exchange;
- status = g_db_collection_recv(collec, fds.fd);
+ status = g_db_collection_recv(collec, fds.fd, NULL);
if (!status) goto gdcu_bad_exchange;
@@ -459,3 +473,30 @@ void g_db_client_put_fd(GDbClient *client)
g_mutex_unlock(&client->sending_lock);
}
+
+
+/******************************************************************************
+* *
+* Paramètres : client = client pour les accès distants à manipuler. *
+* *
+* Description : Effectue une demande de sauvegarde de l'état courant. *
+* *
+* Retour : true si la commande a bien été envoyée, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_db_client_save(GDbClient *client)
+{
+ bool result; /* Bilan partiel à remonter */
+
+ g_db_client_get_fd(client);
+
+ result = safe_send(client->fd, (uint32_t []) { htobe32(DBC_SAVE) }, sizeof(uint32_t), 0);
+
+ g_db_client_put_fd(client);
+
+ return result;
+
+}