summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--command_service.c12
-rw-r--r--control_service.c9
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);