Move to new branch for abstraction
This commit is contained in:
parent
42a9aaa210
commit
47acd4e9af
|
@ -596,6 +596,23 @@ private class BesterConnection : Thread
|
|||
|
||||
private bool handleResponse(JSONValue handlerResponse)
|
||||
{
|
||||
/* TODO: Bounds checking, type checking */
|
||||
try
|
||||
{
|
||||
/* Get the header block */
|
||||
JSONValue headerBlock = handlerResponse["header"];
|
||||
|
||||
/* Get the status */
|
||||
ulong statusCode = headerBlock["status"].uinteger;
|
||||
debugPrint("Status code: " ~ to!(string)(statusCode));
|
||||
|
||||
}
|
||||
catch(JSONException exception)
|
||||
{
|
||||
debugPrint("<<< There was an error handling the response message >>>\n\n" ~ exception.toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
10
spec2.md
10
spec2.md
|
@ -156,14 +156,14 @@ The structure of the `[JSON message]` is as follows:
|
|||
````
|
||||
|
||||
Allowed values for `command` are:
|
||||
1. `"replyClient"`: The generated response is sent back to the
|
||||
client who caused the message handler to process the original
|
||||
message.
|
||||
2. `"sendClients"`: The generated response must be sent to a client(s)
|
||||
1. `"sendClients"`: The generated response must be sent to a client(s)
|
||||
attached to the local server.
|
||||
3. `"sendServers"`: The generated response must be sent to a remote
|
||||
2. `"sendServers"`: The generated response must be sent to a remote
|
||||
server(s).
|
||||
|
||||
The above two tell the server where to send the response from the
|
||||
_message handler_ to. Either it can be sent
|
||||
|
||||
The interpretation of the entirety of the `[JSON message]` is up
|
||||
to the client but the client *SHOULD* expect and interpret as
|
||||
follows:
|
||||
|
|
|
@ -8,7 +8,11 @@ def runTest():
|
|||
while True:
|
||||
s = d.accept()[0]
|
||||
print(list(s.recv(130)))
|
||||
bys = json.dumps({"response" : "ppoop"})
|
||||
bys = json.dumps({
|
||||
"header" : {
|
||||
"status" : 0,
|
||||
"command" : "sendClient"
|
||||
} })
|
||||
print(s.send(bytes([len(bys),0,0,0])))
|
||||
print(s.send(bys.encode()))
|
||||
|
||||
|
|
Loading…
Reference in New Issue