summaryrefslogtreecommitdiff
path: root/src/analysis/db/client.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-10-16 22:04:29 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-10-16 22:04:29 (GMT)
commit6d34dbbb00da0c276261d0e1ce4bf862f22fd8e0 (patch)
treea5d3c8644691934ba84a91919f7db177f70743f1 /src/analysis/db/client.c
parente75f44a99c8f984af4c47fa9a2c8e7e9841700d8 (diff)
Stored a bookmark into the data base and saved the archive.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@414 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
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;
+
+}