From 94792f74a850cf6bb119c59ac0675591f4ef6c0f Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Fri, 3 Mar 2017 21:37:28 +0100
Subject: Fixed a buggy code when updating database for connected clients.

---
 ChangeLog             | 5 +++++
 src/analysis/db/cdb.c | 7 ++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0cfe15e..0c893d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 17-03-03  Cyrille Bagard <nocbos@gmail.com>
 
+	* src/analysis/db/cdb.c:
+	Fix a buggy code when updating database for connected clients.
+
+17-03-03  Cyrille Bagard <nocbos@gmail.com>
+
 	* src/analysis/binary.c:
 	Hide binary code by default.
 
diff --git a/src/analysis/db/cdb.c b/src/analysis/db/cdb.c
index 167fa0c..49662e8 100644
--- a/src/analysis/db/cdb.c
+++ b/src/analysis/db/cdb.c
@@ -809,18 +809,15 @@ static void on_collection_changed(GDbCollection *collec, DBAction action, GDbIte
 
     init_packed_buffer(&pbuf);
 
-    status = true;
+    status = g_db_collection_pack(collec, &pbuf, action, item);
 
     g_mutex_lock(&archive->clients_access);
 
     for (i = 0; i < archive->count && status; i++)
-        status = g_db_collection_pack(collec, &pbuf, action, item);
+        status = send_packed_buffer(&pbuf, archive->clients[i].fd);
 
     g_mutex_unlock(&archive->clients_access);
 
-    if (status)
-        status = send_packed_buffer(&pbuf, archive->clients[i].fd);
-
     exit_packed_buffer(&pbuf);
 
     if (!status)
-- 
cgit v0.11.2-87-g4458