Moved to using new libdnet `awaitNotification`

This commit is contained in:
Tristan B. Kildaire 2020-12-04 18:02:32 +02:00
parent 0d86d22cc7
commit 4cfff3ad4f
1 changed files with 4 additions and 17 deletions

View File

@ -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));
}
}