Compare commits

..

No commits in common. "a51df3b69938e1f82fdc00e34e4e945c4ef0f8ec" and "93d6d49c202aaf8fcbb2bbfdca82d1250de55585" have entirely different histories.

2 changed files with 6 additions and 21 deletions

View File

@ -14,8 +14,6 @@ public class Engine
// TODO: Continue working on this
// TODO: Allow registering ResponseAnonymous with handlers etc
/**
* Takes a request and sends it through to the endpoint
* afterwhich we block for a response and when we get one
@ -37,16 +35,11 @@ public class Engine
/* Send the message */
tManager.sendMessage(tReq);
/* Does this Request expect a response? */
// TODO: We need not register the queue even if this is the case
if(req.expectsResponse())
{
/* Await for a response */
byte[] resp = newQueue.dequeue().getPayload();
/* Await for a response */
byte[] resp = newQueue.dequeue().getPayload();
/* Run the response handler with the response */
req.process(resp);
}
/* Run the response handler with the response */
req.process(resp);
/* De-register the queue */
tManager.releaseQueue(newQueue);

View File

@ -7,6 +7,8 @@ public alias ResponseHandler = void function(byte[]);
public abstract class Request
{
private byte[] requestMessage;
// TODO: Define the below with an alias for a function pointer that accepts a byte[] (the response data)
private ResponseHandler respFunc;
@ -16,11 +18,6 @@ public abstract class Request
this.respFunc = respFunc;
}
protected this(byte[] requestMessage)
{
this(requestMessage, null);
}
package final byte[] getRequestData()
{
return requestMessage;
@ -30,9 +27,4 @@ public abstract class Request
{
respFunc(responseData);
}
package final bool expectsResponse()
{
return respFunc !is null;
}
}