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.
This commit is contained in:
Tristan B. Velloza Kildaire 2022-05-26 12:34:37 +02:00
parent 0f6a10f012
commit 02f8c8f102
1 changed files with 12 additions and 1 deletions

View File

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