From eed104df64dac6e29067d5a458e8aee25694d873 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Mon, 27 Feb 2023 13:23:29 +0200 Subject: [PATCH] Server - Use the `bindPort` parameter when configuring the HTTP server - Updated type of `bindPort` to `ushort` - Save the newly created `Connection` instance into its own variable - Do the fiber call later App - Updated type of `bindPort` to `ushort` --- source/nostril/app.d | 2 +- source/nostril/server.d | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/source/nostril/app.d b/source/nostril/app.d index 84ba44c..ca96121 100644 --- a/source/nostril/app.d +++ b/source/nostril/app.d @@ -20,7 +20,7 @@ import nostril.server; void main() { string[] bindAddresseds = ["::"]; - int bindPort = 8082; + ushort bindPort = 8082; Server server = new Server(bindAddresseds, bindPort); server.startServer(); } diff --git a/source/nostril/server.d b/source/nostril/server.d index 22322a1..559f124 100644 --- a/source/nostril/server.d +++ b/source/nostril/server.d @@ -35,11 +35,11 @@ public class Server - this(string[] bindAddresses, int bindPort) + this(string[] bindAddresses, ushort bindPort) { // Setup where to listen this.httpSettings = new HTTPServerSettings(); - httpSettings.port = 8082; + httpSettings.port = bindPort; httpSettings.bindAddresses = bindAddresses; // Setup a websocket negotiater with a handler attached @@ -78,7 +78,14 @@ public class Server */ void websocketHandler(scope WebSocket socket) { - new Connection(socket).call(); + /* Create a new connection to handle this client */ + Connection connection = new Connection(socket); + + /* Add it to the queue */ + // TODO: Add this + + /* Call the fiber and let it start */ + connection.call(); }