Added methods to add a reserved tag and check whether a tag is reserved, added queue for notifications and also a list of reserved tags
This commit is contained in:
parent
d46da412b4
commit
485995bfe3
|
@ -4,6 +4,7 @@ import tristanable.watcher : Watcher;
|
||||||
import tristanable.request : Request;
|
import tristanable.request : Request;
|
||||||
import tristanable.garbage : GarbageCollector;
|
import tristanable.garbage : GarbageCollector;
|
||||||
import tristanable.encoding : DataMessage;
|
import tristanable.encoding : DataMessage;
|
||||||
|
import tristanable.notifications : NotificationReply;
|
||||||
import std.socket : Socket;
|
import std.socket : Socket;
|
||||||
import core.sync.mutex : Mutex;
|
import core.sync.mutex : Mutex;
|
||||||
import bmessage : bSendMessage = sendMessage;
|
import bmessage : bSendMessage = sendMessage;
|
||||||
|
@ -19,6 +20,16 @@ public final class Manager
|
||||||
*/
|
*/
|
||||||
private Request[] requestQueue;
|
private Request[] requestQueue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reserved tags
|
||||||
|
*/
|
||||||
|
private ulong[] reservedTags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The queue of received notifications
|
||||||
|
*/
|
||||||
|
private NotificationReply[] notificationQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The associated Watcher object for this manager.
|
* The associated Watcher object for this manager.
|
||||||
*/
|
*/
|
||||||
|
@ -204,6 +215,25 @@ public final class Manager
|
||||||
{
|
{
|
||||||
queueMutex.unlock();
|
queueMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reserveTag(ulong tag)
|
||||||
|
{
|
||||||
|
reservedTags ~= tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool isReservedTag(ulong tag)
|
||||||
|
{
|
||||||
|
foreach(ulong currentTag; reservedTags)
|
||||||
|
{
|
||||||
|
if(currentTag == tag)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class TristanFokop : Exception
|
public final class TristanFokop : Exception
|
||||||
|
|
Loading…
Reference in New Issue