summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analysis/binary.c4
-rw-r--r--src/analysis/db/cdb.c3
-rw-r--r--src/analysis/db/client.c7
-rw-r--r--src/common/packed.c23
-rw-r--r--src/common/packed.h3
5 files changed, 27 insertions, 13 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 8c3d3b6..5b97eb9 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -955,8 +955,6 @@ static bool g_loaded_binary_connect_internal(GLoadedBinary *binary)
result = g_db_client_start_internal(binary->local);
- printf("DB status :: %d\n", result);
-
glbcl_exit:
@@ -1031,8 +1029,6 @@ static bool g_loaded_binary_connect_remote(GLoadedBinary *binary)
result = g_db_client_start_remote(binary->local, host, port);
- printf("DB status :: %d\n", result);
-
glbcl_exit:
diff --git a/src/analysis/db/cdb.c b/src/analysis/db/cdb.c
index 170bdfa..9479b4d 100644
--- a/src/analysis/db/cdb.c
+++ b/src/analysis/db/cdb.c
@@ -1079,7 +1079,6 @@ DBError g_cdb_archive_add_client(GCdbArchive *archive, int fd, const rle_string
- printf("Add '%s' for archive...\n", user->data);
g_mutex_lock(&archive->clients_access);
@@ -1131,7 +1130,7 @@ DBError g_cdb_archive_add_client(GCdbArchive *archive, int fd, const rle_string
}
- if (status)
+ if (status && get_packed_buffer_payload_length(&out_pbuf) > 0)
status = send_packed_buffer(&out_pbuf, fd);
exit_packed_buffer(&out_pbuf);
diff --git a/src/analysis/db/client.c b/src/analysis/db/client.c
index 26d71f3..16d243a 100644
--- a/src/analysis/db/client.c
+++ b/src/analysis/db/client.c
@@ -517,8 +517,6 @@ static void *g_db_client_update(GDbClient *client)
ret = poll(&fds, 1, -1);
if (ret != 1) continue;
- printf("fds.revents :: %x\n", fds.revents);
-
/* Le canal est fermé, une sortie doit être demandée... */
if (fds.revents & POLLNVAL)
break;
@@ -560,11 +558,6 @@ static void *g_db_client_update(GDbClient *client)
status = g_db_collection_unpack(collec, &in_pbuf, NULL);
if (!status) goto gdcu_bad_exchange;
-
-
-
- printf("## CLIENT ## Got Something to read...\n");
-
break;
}
diff --git a/src/common/packed.c b/src/common/packed.c
index 21ba988..1abfa98 100644
--- a/src/common/packed.c
+++ b/src/common/packed.c
@@ -82,6 +82,29 @@ void exit_packed_buffer(packed_buffer *pbuf)
/******************************************************************************
* *
+* Paramètres : pbuf = paquet de données à consulter. *
+* *
+* Description : Indique le nombre d'octets de la charge utile d'un paquet. *
+* *
+* Retour : Quantité de données utiles. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+size_t get_packed_buffer_payload_length(const packed_buffer *pbuf)
+{
+ size_t result; /* Quantité à renvoyer */
+
+ result = pbuf->used;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : pbuf = paquet de données à compléter. *
* buf = nouvelles données à ajouter. *
* len = quantité de ces données. *
diff --git a/src/common/packed.h b/src/common/packed.h
index 7b4890d..64d5d20 100644
--- a/src/common/packed.h
+++ b/src/common/packed.h
@@ -52,6 +52,9 @@ void init_packed_buffer(packed_buffer *);
/* Efface les données contenues par un paquet réseau. */
void exit_packed_buffer(packed_buffer *);
+/* Indique le nombre d'octets de la charge utile d'un paquet. */
+size_t get_packed_buffer_payload_length(const packed_buffer *);
+
/* Ajoute des données à un paquet en amont à un envoi. */
bool extend_packed_buffer(packed_buffer *, const void *, size_t, bool);