diff options
author | Jacki <jacki@thejackimonster.de> | 2024-07-21 04:32:01 +0200 |
---|---|---|
committer | Jacki <jacki@thejackimonster.de> | 2024-07-21 04:32:01 +0200 |
commit | 8e629200ae1e2187eddda70093f75ea5e42426a7 (patch) | |
tree | ddfa23850fd2804e6c6f9e1f810a69373285295d | |
parent | 0e3fb410988e339bdf5e3d21383bca11caec548c (diff) | |
download | messenger-gtk-8e629200ae1e2187eddda70093f75ea5e42426a7.tar.gz messenger-gtk-8e629200ae1e2187eddda70093f75ea5e42426a7.zip |
Remove idle task from chat handle in application
-rw-r--r-- | src/application.c | 3 | ||||
-rw-r--r-- | src/chat/messenger.c | 25 | ||||
-rw-r--r-- | src/chat/messenger.h | 2 |
3 files changed, 0 insertions, 30 deletions
diff --git a/src/application.c b/src/application.c index cb9be47..2eb1f73 100644 --- a/src/application.c +++ b/src/application.c | |||
@@ -774,9 +774,6 @@ _application_stop_chat(gpointer user_data) | |||
774 | { | 774 | { |
775 | MESSENGER_Application *app = user_data; | 775 | MESSENGER_Application *app = user_data; |
776 | 776 | ||
777 | if (app->chat.messenger.idle) | ||
778 | GNUNET_SCHEDULER_cancel(app->chat.messenger.idle); | ||
779 | |||
780 | GNUNET_CHAT_disconnect(app->chat.messenger.handle); | 777 | GNUNET_CHAT_disconnect(app->chat.messenger.handle); |
781 | GNUNET_CHAT_stop(app->chat.messenger.handle); | 778 | GNUNET_CHAT_stop(app->chat.messenger.handle); |
782 | app->chat.messenger.handle = NULL; | 779 | app->chat.messenger.handle = NULL; |
diff --git a/src/chat/messenger.c b/src/chat/messenger.c index 23ab01e..6455760 100644 --- a/src/chat/messenger.c +++ b/src/chat/messenger.c | |||
@@ -27,23 +27,6 @@ | |||
27 | #include "../event.h" | 27 | #include "../event.h" |
28 | #include <gnunet/gnunet_chat_lib.h> | 28 | #include <gnunet/gnunet_chat_lib.h> |
29 | 29 | ||
30 | static void | ||
31 | _chat_messenger_idle(void *cls) | ||
32 | { | ||
33 | g_assert(cls); | ||
34 | |||
35 | MESSENGER_Application *app = (MESSENGER_Application*) cls; | ||
36 | |||
37 | // Idling until the application shuts down | ||
38 | // (required to get events immediately). | ||
39 | app->chat.messenger.idle = GNUNET_SCHEDULER_add_delayed_with_priority( | ||
40 | GNUNET_TIME_relative_get_second_(), | ||
41 | GNUNET_SCHEDULER_PRIORITY_IDLE, | ||
42 | &_chat_messenger_idle, | ||
43 | app | ||
44 | ); | ||
45 | } | ||
46 | |||
47 | static int | 30 | static int |
48 | _chat_messenger_message(void *cls, | 31 | _chat_messenger_message(void *cls, |
49 | struct GNUNET_CHAT_Context *context, | 32 | struct GNUNET_CHAT_Context *context, |
@@ -227,17 +210,9 @@ chat_messenger_run(void *cls, | |||
227 | 210 | ||
228 | schedule_load_gnunet(&(app->chat.schedule)); | 211 | schedule_load_gnunet(&(app->chat.schedule)); |
229 | 212 | ||
230 | // Start libgnunetchat handle | ||
231 | app->chat.messenger.handle = GNUNET_CHAT_start( | 213 | app->chat.messenger.handle = GNUNET_CHAT_start( |
232 | cfg, | 214 | cfg, |
233 | &_chat_messenger_message, | 215 | &_chat_messenger_message, |
234 | app | 216 | app |
235 | ); | 217 | ); |
236 | |||
237 | // The idle callback seems to be necessary to not wait too long for | ||
238 | // other events | ||
239 | app->chat.messenger.idle = GNUNET_SCHEDULER_add_now( | ||
240 | &_chat_messenger_idle, | ||
241 | app | ||
242 | ); | ||
243 | } | 218 | } |
diff --git a/src/chat/messenger.h b/src/chat/messenger.h index 3ab1910..ad063d4 100644 --- a/src/chat/messenger.h +++ b/src/chat/messenger.h | |||
@@ -32,8 +32,6 @@ typedef struct MESSENGER_Application MESSENGER_Application; | |||
32 | typedef struct CHAT_MESSENGER_Handle | 32 | typedef struct CHAT_MESSENGER_Handle |
33 | { | 33 | { |
34 | struct GNUNET_CHAT_Handle *handle; | 34 | struct GNUNET_CHAT_Handle *handle; |
35 | struct GNUNET_SCHEDULER_Task *quit; | ||
36 | struct GNUNET_SCHEDULER_Task *idle; | ||
37 | } CHAT_MESSENGER_Handle; | 35 | } CHAT_MESSENGER_Handle; |
38 | 36 | ||
39 | /** | 37 | /** |