summaryrefslogtreecommitdiff
path: root/src/analysis/db/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/db/server.c')
-rw-r--r--src/analysis/db/server.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c
index b636d02..acdf200 100644
--- a/src/analysis/db/server.c
+++ b/src/analysis/db/server.c
@@ -33,6 +33,7 @@
#include "protocol.h"
+#include "../../gui/panels/log.h"
@@ -53,7 +54,8 @@ struct _GDbServer
{
GObject parent; /* A laisser en premier */
- int fd;
+ int fd; /* Canal de communication */
+ char *hostname; /* Désignation humaine */
struct sockaddr_in addr; /* Adresse d'écoute */
GThread *listener; /* Procédure de traitement */
@@ -139,7 +141,7 @@ static void g_db_server_init(GDbServer *server)
/******************************************************************************
* *
-* Paramètres : binary = instance d'objet GLib à traiter. *
+* Paramètres : server = instance d'objet GLib à traiter. *
* *
* Description : Procède à la libération totale de la mémoire. *
* *
@@ -149,11 +151,11 @@ static void g_db_server_init(GDbServer *server)
* *
******************************************************************************/
-static void g_db_server_finalize(GDbServer *binary)
+static void g_db_server_finalize(GDbServer *server)
{
- //free(binary->filename);
+ free(server->hostname);
- G_OBJECT_CLASS(g_db_server_parent_class)->finalize(G_OBJECT(binary));
+ G_OBJECT_CLASS(g_db_server_parent_class)->finalize(G_OBJECT(server));
}
@@ -178,6 +180,8 @@ GDbServer *g_db_server_new(const char *host, short port)
result = g_object_new(G_TYPE_DB_SERVER, NULL);
+ result->hostname = strdup(host);
+
hp = gethostbyname(host);
if (hp == NULL) goto gdsn_error;
@@ -383,6 +387,9 @@ bool g_db_server_start(GDbServer *server)
server->listener = g_thread_new("cdb_listener", (GThreadFunc)g_db_server_listener, server);
+ log_variadic_message(LMT_PROCESS, _("Server started and listening at %s:%hu"),
+ server->hostname, ntohs(server->addr.sin_port));
+
return true;
}