aboutsummaryrefslogtreecommitdiff
path: root/src/chat/messenger.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chat/messenger.c')
-rw-r--r--src/chat/messenger.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/chat/messenger.c b/src/chat/messenger.c
index eb8523b..ad05158 100644
--- a/src/chat/messenger.c
+++ b/src/chat/messenger.c
@@ -42,6 +42,9 @@ _chat_messenger_quit(void *cls)
42{ 42{
43 MESSENGER_Application *app = (MESSENGER_Application*) cls; 43 MESSENGER_Application *app = (MESSENGER_Application*) cls;
44 44
45 if (app->chat.messenger.idle)
46 GNUNET_SCHEDULER_cancel(app->chat.messenger.idle);
47
45 MESSENGER_ApplicationSignal signal; 48 MESSENGER_ApplicationSignal signal;
46 int received = read(app->chat.pipe[0], &signal, sizeof(signal)); 49 int received = read(app->chat.pipe[0], &signal, sizeof(signal));
47 50
@@ -60,6 +63,19 @@ _chat_messenger_quit(void *cls)
60 GNUNET_SCHEDULER_shutdown(); 63 GNUNET_SCHEDULER_shutdown();
61} 64}
62 65
66static void
67_chat_messenger_idle(void *cls)
68{
69 MESSENGER_Application *app = (MESSENGER_Application*) cls;
70
71 app->chat.messenger.idle = GNUNET_SCHEDULER_add_delayed_with_priority(
72 GNUNET_TIME_relative_get_second_(),
73 GNUNET_SCHEDULER_PRIORITY_IDLE,
74 &_chat_messenger_idle,
75 app
76 );
77}
78
63static int 79static int
64_chat_messenger_message(void *cls, 80_chat_messenger_message(void *cls,
65 struct GNUNET_CHAT_Context *context, 81 struct GNUNET_CHAT_Context *context,
@@ -186,5 +202,10 @@ chat_messenger_run(void *cls,
186 app 202 app
187 ); 203 );
188 204
205 app->chat.messenger.idle = GNUNET_SCHEDULER_add_now(
206 &_chat_messenger_idle,
207 app
208 );
209
189 GNUNET_NETWORK_fdset_destroy(fd); 210 GNUNET_NETWORK_fdset_destroy(fd);
190} 211}