WIP: `sendMessage(ulong, byte[])`

This commit is contained in:
Tristan B. Kildaire 2020-06-22 22:21:33 +02:00
parent ebdfad5023
commit 47e9059a66
1 changed files with 21 additions and 1 deletions

View File

@ -3,6 +3,7 @@ module tristanable.manager;
import tristanable.watcher : Watcher;
import tristanable.request : Request;
import std.socket : Socket;
import core.sync.mutex : Mutex;
/* TODO: Watcher class to watch for stuff, and add to manager's queues */
/* TODO: maneger class to use commands on, enqueue and wait for dequeue */
@ -20,6 +21,11 @@ public final class Manager
*/
private Watcher watcher;
/**
* The list mutex
*/
private Mutex queueMutex;
this(Socket endpoint)
{
/* TODO: Create the watcher */
@ -27,6 +33,9 @@ public final class Manager
/* TODO: Other initializations (queues etc.) */
/* Initialize the `requestQueue` mutex */
queueMutex = new Mutex();
/* Start the watcher */
watcher.start();
}
@ -34,6 +43,17 @@ public final class Manager
public void sendMessage(ulong tag, byte[] data)
{
/* TODO: Implement me */
/* Construct the message array */
byte[] messageData;
/* Send the message */
/* Create a new Request */
Request newRequest = new Request(tag);
/* Add the request to the request queue */
enqueue(newRequest);
}
public byte[] receiveMessage(ulong tag)
@ -48,6 +68,6 @@ public final class Manager
public void enqueue(Request request)
{
}
}