From 02f8c8f102506df0938a191164c19e8323e04415 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Thu, 26 May 2022 12:34:37 +0200 Subject: [PATCH] New feature: On-receive queuing In the case where this is enabled, via the Manager constructor's last boolean argument, then any message with a tag that does no match any existing queue will trigger the creation of a new queue with said tag, addition of said queue to the manager and appending of the triggering message to said queue. --- source/tristanable/manager.d | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/tristanable/manager.d b/source/tristanable/manager.d index 379598c..aae75a6 100644 --- a/source/tristanable/manager.d +++ b/source/tristanable/manager.d @@ -43,18 +43,24 @@ public final class Manager private bool isAlive; + private bool onRecvQueue; + + /** * Constructs a new Manager with the given * endpoint Socket * */ - this(Socket socket, Duration timeOut = dur!("msecs")(100), bool newSys = false) + this(Socket socket, Duration timeOut = dur!("msecs")(100), bool newSys = false, bool onRecvQueue = false) { /* TODO: Make sure the socket is in STREAM mode */ /* Set the socket */ this.socket = socket; + /* Set whether this should have on-receive queue funtionality */ + this.onRecvQueue = onRecvQueue; + /* Initialize the queues mutex */ queuesLock = new Mutex(); @@ -74,6 +80,11 @@ public final class Manager watcher.start(); } + public bool isOnRecvQueue() + { + return onRecvQueue; + } + public Queue getQueue(ulong tag) { Queue matchingQueue;