Added missing `bind()` call to DListener

This commit is contained in:
Tristan B. Kildaire 2020-12-20 18:12:11 +02:00
parent 917402e974
commit 0da2a73226
2 changed files with 10 additions and 1 deletions

View File

@ -29,6 +29,10 @@ public final class DListener : Thread
// /* Get the Address */
Address address = addressInfo.address;
gprintln("DListener: Hello there I am a new listener "~to!(string)(addressInfo));
/* TODO: Check AF_FAMILY (can only be INET,INET6,UNIX) */
@ -38,6 +42,8 @@ public final class DListener : Thread
/* Create the Socket and bind it */
serverSocket = new Socket(addressInfo);
// serverSocket = new Socket(AddressFamily.INET, SocketType.STREAM, ProtocolType.TCP);
serverSocket.bind(address);
gprintln("New listener started with address "~to!(string)(addressInfo));
/* Start the connection dequeue thread */
@ -46,7 +52,7 @@ public final class DListener : Thread
private void dequeueLoop()
{
gprintln("Starting listener...");
gprintln("Starting dequeue loop. on socket "~to!(string)(serverSocket)~"...");
/* Start accepting-and-enqueuing connections */
serverSocket.listen(0); /* TODO: Linux be lile, hehahahhahahah who gives one - I give zero */
@ -54,7 +60,9 @@ public final class DListener : Thread
while(true)
{
/* Dequeue a connection */
gprintln("Awaiting a connection...");
Socket socket = serverSocket.accept();
gprintln("Dequeued a socket");
/* Spawn a connection handler */
DConnection connection = new DConnection(server, socket);

View File

@ -109,6 +109,7 @@ public class DServer : Thread
foreach(DListener listener; listeners)
{
/* Start the listener */
gprintln("Starting listener "~to!(string)(listener)~"...");
listener.start();
}
}