From 4cfff3ad4ff4667476f53ccf2e38979f3e1cca96 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Fri, 4 Dec 2020 18:02:32 +0200 Subject: [PATCH] Moved to using new libdnet `awaitNotification` --- source/notifications.d | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/source/notifications.d b/source/notifications.d index 1c2a131..5ddcc6e 100644 --- a/source/notifications.d +++ b/source/notifications.d @@ -22,24 +22,11 @@ public class NotificationWatcher : Thread { while(true) { - /* Check for notifications every 2 seconds */ - NotificationReply[] notifications =manager.popNotifications(); - - if(notifications.length) - { - //writeln(notifications); - foreach(NotificationReply notificationReply; notifications) - { - //writeln(notificationReply.getData()); - - /* Await a notification */ - manager.awaitNotification(); - string msg = cast(string)notificationReply.getData(); - writeln("!> "~msg); - process(notificationReply.getData()); - } - } + /* Await a notification */ + byte[] notification = manager.awaitNotification(); + process(notification); + /* TODO: Below? */ Thread.getThis().sleep(dur!("seconds")(2)); } }