summaryrefslogtreecommitdiff
path: root/src/analysis/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/db')
-rw-r--r--src/analysis/db/server.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c
index 0270201..6155b6d 100644
--- a/src/analysis/db/server.c
+++ b/src/analysis/db/server.c
@@ -497,7 +497,7 @@ static void *g_db_server_listener(GDbServer *server)
if (ret != 1) continue;
/* Le canal est fermé, une sortie doit être demandée... */
- if (fds.revents & POLLNVAL)
+ if (fds.revents & POLLHUP)
break;
if (fds.revents & (POLLIN | POLLPRI))
@@ -802,14 +802,21 @@ bool g_db_server_start(GDbServer *server)
void g_db_server_stop(GDbServer *server)
{
- if (server->fd != -1)
+ int ret; /* Bilan d'un appel */
+
+ if (server->fd == -1)
return;
- close(server->fd);
- server->fd = -1;
+ ret = shutdown(server->fd, SHUT_RDWR);
+ if (ret == -1) perror("shutdown");
g_thread_join(server->listener);
+ ret = close(server->fd);
+ if (ret == -1) perror("close");
+
+ server->fd = -1;
+
/* TODO : s'occuper des archives ouvertes */
}