summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/db/client.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/analysis/db/client.c b/src/analysis/db/client.c
index f70c9e1..5999b70 100644
--- a/src/analysis/db/client.c
+++ b/src/analysis/db/client.c
@@ -503,8 +503,8 @@ static bool g_db_client_start_common(GDbClient *client, const char *desc)
static void *g_db_client_update(GDbClient *client)
{
struct pollfd fds; /* Surveillance des flux */
- int ret; /* Bilan d'un appel */
packed_buffer in_pbuf; /* Tampon de réception */
+ int ret; /* Bilan d'un appel */
uint32_t tmp32; /* Valeur sur 32 bits */
bool status; /* Bilan d'une opération */
uint32_t command; /* Commande de la requête */
@@ -514,6 +514,8 @@ static void *g_db_client_update(GDbClient *client)
fds.fd = client->fd;
fds.events = POLLIN | POLLPRI;
+ init_packed_buffer(&in_pbuf);
+
while (1)
{
ret = poll(&fds, 1, -1);
@@ -525,6 +527,8 @@ static void *g_db_client_update(GDbClient *client)
if (fds.revents & (POLLIN | POLLPRI))
{
+ reset_packed_buffer(&in_pbuf);
+
status = recv_packed_buffer(&in_pbuf, fds.fd);
if (!status) goto gdcu_bad_exchange;
@@ -564,16 +568,12 @@ static void *g_db_client_update(GDbClient *client)
}
- exit_packed_buffer(&in_pbuf);
-
continue;
gdcu_bad_exchange:
printf("Bad reception...\n");
- exit_packed_buffer(&in_pbuf);
-
/* TODO : close conn */
;
@@ -586,6 +586,8 @@ static void *g_db_client_update(GDbClient *client)
//g_db_client_stop(client);
+ exit_packed_buffer(&in_pbuf);
+
return NULL;
}