summaryrefslogtreecommitdiff
path: root/control_service.c
diff options
context:
space:
mode:
Diffstat (limited to 'control_service.c')
-rw-r--r--control_service.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/control_service.c b/control_service.c
index 1dca7a9..150db6d 100644
--- a/control_service.c
+++ b/control_service.c
@@ -1,11 +1,12 @@
#include "control_service.h"
-#include "control_commands.h"
+#include "commands.h"
#include "conf.h"
#include <glib.h>
#include <glib/gstdio.h>
#include <gio/gio.h>
#include <gio/gunixsocketaddress.h>
+#include <string.h>
static GSocketService *ss = NULL;
static GSocketAddress *address;
@@ -13,6 +14,7 @@ static GSocketAddress *address;
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);
@@ -30,7 +32,16 @@ static gboolean service_incoming(GSocketService *service,
}
*pos = '\0';
- control_commands_handle(connection, buffer);
+ commands_handle(connection, buffer, &error);
+
+ if(error != NULL) {
+ g_warning(error->message);
+ gchar *error_buffer = g_strdup_printf("%s\n", error->message);
+ g_socket_send(socket, error_buffer, strlen(error_buffer), NULL, NULL);
+ g_free(error_buffer);
+ g_error_free(error);
+ error = NULL;
+ }
}
return FALSE;