summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--communication_source.c47
-rw-r--r--communication_source.h16
-rw-r--r--main.c3
3 files changed, 0 insertions, 66 deletions
diff --git a/communication_source.c b/communication_source.c
deleted file mode 100644
index 509366f..0000000
--- a/communication_source.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "communication_source.h"
-#include "servers.h"
-#include "server_communication.h"
-
-static GQueue *jobqueue = NULL;
-
-void communication_job_add(struct server *server) {
- g_queue_push_head(jobqueue, server);
-}
-
-gboolean comsrc_prepare(GSource *source, gint *timeout) {
- g_debug("comsrc_prepare()");
- *timeout = 2000;
- return g_queue_get_length(jobqueue) > 0 ? TRUE : FALSE;
-}
-
-gboolean comsrc_check(GSource *source) {
- g_debug("comsrc_check()");
- return g_queue_get_length(jobqueue) > 0 ? TRUE : FALSE;
-}
-
-gboolean comsrc_dispatch(GSource *source, GSourceFuncs callback, gpointer user_data) {
- g_debug("comsrc_dispatch(), callback is %x, user_data is %x", callback, user_data);
- struct server *server = g_queue_pop_tail(jobqueue);
- server_ping(server);
- return TRUE;
-}
-
-void comsrc_finalize(GSource *source) {
-}
-
-static const GSourceFuncs com_src_funcs = {
- .prepare = comsrc_prepare,
- .check = comsrc_check,
- .dispatch = comsrc_dispatch,
- .finalize = comsrc_finalize,
-};
-
-void communication_source_init(GMainLoop *mainloop) {
- jobqueue = g_queue_new();
-
- GMainContext *context = g_main_loop_get_context(mainloop);
- GSource *source = g_source_new(&com_src_funcs, sizeof(GSource));
- g_source_attach(source, context);
-
- communication_job_add(servers->data);
-}
diff --git a/communication_source.h b/communication_source.h
deleted file mode 100644
index 0856cf4..0000000
--- a/communication_source.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef COMMUNICATION_SOURCE_H
-#define COMMUNICATION_SOURCE_H
-
-#include "servers.h"
-
-#include <glib.h>
-
-struct communication_job {
- struct server *server;
-};
-
-void communication_job_add(struct server *server);
-
-void communication_source_init(GMainLoop *mainloop);
-
-#endif
diff --git a/main.c b/main.c
index 4d0f46b..07eb66e 100644
--- a/main.c
+++ b/main.c
@@ -4,7 +4,6 @@
#include "conf.h"
#include "servers.h"
#include "control_service.h"
-#include "communication_source.h"
#include <glib.h>
#include <glib-object.h>
@@ -37,8 +36,6 @@ int main(int argc, char **argv) {
main_loop = g_main_loop_new(NULL, FALSE);
- communication_source_init(main_loop);
-
g_main_loop_run(main_loop);
g_main_loop_unref(main_loop);