diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-08-28 12:15:49 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-08-28 12:15:49 +0200 |
commit | 9ac3c2b3560da178800e5ad88ce29973454a66e5 (patch) | |
tree | 973a6577c41fd13cc32bb4ade4f47dbf60135cae | |
parent | 30e4a720a0a7f0a4010169e26230f1c3169158d1 (diff) |
Minor cleanup in services.
-rw-r--r-- | command_service.c | 12 | ||||
-rw-r--r-- | control_service.c | 9 |
2 files changed, 14 insertions, 7 deletions
diff --git a/command_service.c b/command_service.c index a23fc0e..5ef7fed 100644 --- a/command_service.c +++ b/command_service.c @@ -24,9 +24,6 @@ static gboolean service_incoming(GSocketService *service, break; } - g_debug("size == %ld", size); - g_debug(buffer); - gchar *pos, *eol; pos = buffer; while((eol = g_strstr_len(pos, size, "\n")) != NULL || (eol = g_strstr_len(pos, size, "\r")) != NULL) { @@ -52,9 +49,16 @@ static gboolean service_incoming(GSocketService *service, } gboolean server_start() { + GError *error = NULL; + ss = g_threaded_socket_service_new(10); - g_socket_listener_add_inet_port((GSocketListener*)ss, 7681, NULL, NULL); + if(g_socket_listener_add_inet_port((GSocketListener*)ss, 7681, NULL, + &error) == FALSE) { + g_warning("failed to set port: %s", error->message); + g_error_free(error); + return FALSE; + } g_signal_connect(ss, "incoming", (GCallback)service_incoming, NULL); g_socket_service_start(ss); diff --git a/control_service.c b/control_service.c index 150db6d..a496812 100644 --- a/control_service.c +++ b/control_service.c @@ -15,7 +15,6 @@ static gboolean service_incoming(GSocketService *service, GSocketConnection *connection, GObject *source_object, gpointer user_data) { GError *error = NULL; - g_debug("local service got incoming connection"); GSocket *socket = g_socket_connection_get_socket(connection); gchar buffer[0x400]; @@ -48,6 +47,8 @@ static gboolean service_incoming(GSocketService *service, } gboolean control_service_start() { + GError *error = NULL; + gchar *sockname = conf_get_string("audist", "control_socket"); if(sockname == NULL) { g_warning("control_socket not set in config, can't start control service"); @@ -59,8 +60,10 @@ gboolean control_service_start() { if(g_socket_listener_add_address((GSocketListener*)ss, address, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_DEFAULT, NULL, - NULL, NULL) == FALSE) { - g_error("g_socket_listener_add_socket() failed"); + NULL, &error) == FALSE) { + g_warning("failed to set socket address: %s", error->message); + g_error_free(error); + return FALSE; } g_signal_connect(ss, "incoming", (GCallback)service_incoming, NULL); |