diff --git a/server.conf b/server.conf index 62b84cb..dce807a 100644 --- a/server.conf +++ b/server.conf @@ -16,8 +16,8 @@ "handlers" : { "availableTypes" : ["type1", "type2"], "typeMap" : { - "type1" : {"handlerBinary" : "aBin", "unixDomainSocketPath" : "aSock"}, - "type2" : {"handlerBinary" : "bBin", "unixDomainSocketPath" : "bSock"} + "type1" : {"handlerBinary" : "./testing/unixSock.py", "unixDomainSocketPath" : "aSock"}, + "type2" : {"handlerBinary" : "./testing/unixSock2.py", "unixDomainSocketPath" : "bSock"} } }, "admin" : { diff --git a/source/handlers/handler.d b/source/handlers/handler.d index 0e5ab99..00c0ac3 100644 --- a/source/handlers/handler.d +++ b/source/handlers/handler.d @@ -8,6 +8,7 @@ import handlers.response; import base.net; import connection.message; import server.server : BesterServer; +import std.process : spawnProcess, Pid; public final class MessageHandler { @@ -26,6 +27,9 @@ public final class MessageHandler /* The BesterServer being used */ public BesterServer server; + /* The PID of the process */ + private Pid pid; + public Socket getSocket() { return domainSocket; @@ -36,14 +40,19 @@ public final class MessageHandler /* Set the plugin name */ this.pluginName = pluginName; - /* Initialize the socket */ - //initializeUNIXSocket(socketPath); - /* Set the socket path */ this.socketPath = socketPath; /* Set the server this handler is associated with */ this.server = server; + + /* Start the message handler */ + startHandlerExecutable(); + } + + private void startHandlerExecutable() + { + // pid = spawnProcess(executablePath); } public string getPluginName() diff --git a/source/utils/debugger.d b/source/utils/debugger.d index 2f77906..f171695 100644 --- a/source/utils/debugger.d +++ b/source/utils/debugger.d @@ -2,14 +2,15 @@ module utils.debugging; import std.stdio : writeln; import std.process : environment; +import std.conv : to; alias dprint = debugPrint; -void debugPrint(string message) +void debugPrint(MessageType)(MessageType message) { /* Check if the environment variable for `B_DEBUG` exists */ if(!(environment.get("B_DEBUG") is null)) { - writeln("[DEBUG] " ~ message); + writeln("[DEBUG] " ~ to!(string)(message)); } } \ No newline at end of file diff --git a/testing/unixSock.py b/testing/unixSock.py old mode 100644 new mode 100755 index fcf26af..2193375 --- a/testing/unixSock.py +++ b/testing/unixSock.py @@ -1,3 +1,5 @@ +#!/bin/python3 + import socket import json diff --git a/testing/unixSock2.py b/testing/unixSock2.py old mode 100644 new mode 100755 index 9ebe818..b7ebe28 --- a/testing/unixSock2.py +++ b/testing/unixSock2.py @@ -1,3 +1,5 @@ +#!/bin/python3 + import socket import json diff --git a/testing/unixSockBackup.py b/testing/unixSockBackup.py old mode 100644 new mode 100755