WIP: Class being initted again

This commit is contained in:
Tristan B. Kildaire 2020-04-30 14:25:12 +02:00
parent 8dafb94a37
commit 69a399b928
2 changed files with 13 additions and 1 deletions

View File

@ -41,8 +41,12 @@ public final class HandlerResponse
/* Set the handler who caused this reponse to occur */ /* Set the handler who caused this reponse to occur */
this.handler = handler; this.handler = handler;
writeln("Heyo ", server);
/* Attempt parsing the message and error checking it */ /* Attempt parsing the message and error checking it */
parse(messageResponse); parse(messageResponse);
} }
private void parse(JSONValue handlerResponse) private void parse(JSONValue handlerResponse)
@ -279,14 +283,21 @@ public final class HandlerResponse
} }
else if (commandType == CommandType.SEND_HANDLER) else if (commandType == CommandType.SEND_HANDLER)
{ {
debugPrint(messageResponse.toPrettyString());
/* Name of the handler to send the message to */ /* Name of the handler to send the message to */
string handler = messageResponse["header"]["command"]["data"]["type"].str(); string handler = messageResponse["header"]["command"]["data"].str();
debugPrint("Handler to forward to: " ~ handler); debugPrint("Handler to forward to: " ~ handler);
/* TODO: Add me, shit is going to get recursive here */ /* TODO: Add me, shit is going to get recursive here */
writeln("jdfjfdhhjfh", HandlerResponse.server);
writeln("jdfjfdhhjfh", server);
writeln(server is null);
/* Lookup the payloadType handler */ /* Lookup the payloadType handler */
MessageHandler chosenHandler = server.findHandler(handler); MessageHandler chosenHandler = server.findHandler(handler);
writeln(chosenHandler is null);
HandlerResponse handlerResponse = chosenHandler.handleMessage(messageResponse["data"]); HandlerResponse handlerResponse = chosenHandler.handleMessage(messageResponse["data"]);

View File

@ -78,6 +78,7 @@ public final class BesterServer
* to be this server. * to be this server.
*/ */
HandlerResponse.server = this; HandlerResponse.server = this;
writeln("jdfjfdhhjfh", HandlerResponse.server);
} }
private void setupHandlers(JSONValue handlerBlock) private void setupHandlers(JSONValue handlerBlock)