This commit is contained in:
Tristan B. Kildaire 2020-04-17 18:47:05 +02:00
parent 0417f5cca5
commit cb2539cbc2
2 changed files with 16 additions and 4 deletions

View File

@ -5,10 +5,22 @@ import std.conv : to;
import std.socket : SocketOSException;
import utils.debugging : debugPrint;
void startServer(string address, ushort port)
void startServer(string configurationFilePath)
{
BesterServer server = null;
/* TODO: Open the file here */
File configFile;
configFile.open(configurationFilePath);
/* The file buffer */
byte[] fileBuffer;
/* Allocate the buffer to be the size of the file */
fileBuffer.length = configFile.size();
/* TODO: File read here */
try
{
server = new BesterServer(address, port);

View File

@ -4,7 +4,7 @@ import utils.debugging : debugPrint;
import std.conv : to;
import std.socket : Socket, AddressFamily, SocketType, ProtocolType, parseAddress, SocketFlags;
import core.thread : Thread;
import std.stdio : writeln;
import std.stdio : writeln, File;
import std.json : JSONValue, parseJSON, JSONException, JSONType;
import std.string : cmp;
import server.handler;
@ -26,15 +26,15 @@ public class BesterServer
{
debugPrint("Binding to address: " ~ bindAddress ~ " and port " ~ to!(string)(listenPort));
initialize(bindAddress, listenPort);
debugPrint("Setting up message handlers...");
//setupHandlers(configurationFile);
}
private void loadHandlers(JSONValue handlerBlock)
{
/* TODO: Implement me */
debugPrint("Constructing message handlers...");
MessageHandler.constructHandlers(handlerBlock);
}
private void initialize(string bindAddress, ushort listenPort)