Added missing Server instance to all Connection sub-classes

This commit is contained in:
Tristan B. Velloza Kildaire 2021-12-26 12:13:21 +02:00
parent 093211f7f9
commit b6d84cfa92
2 changed files with 14 additions and 4 deletions

View File

@ -4,6 +4,7 @@
module dnetd.connection.connection;
import core.thread : Thread;
import dnetd.server : Server;
/**
* Represents a client's/server's connection to
@ -14,9 +15,16 @@ import core.thread : Thread;
*/
public abstract class Connection : Thread
{
this()
/**
* The server instance this Connection
* is associated with
*/
private Server server;
this(Server server)
{
super(&handler);
this.server = server;
}
/**

View File

@ -4,6 +4,7 @@
import dnetd.connection.connection : Connection;
import std.socket;
import dnetd.server : Server;
/**
* FIXME: When we do anything so far, I am assuming
@ -12,11 +13,12 @@ import std.socket;
*/
public final class SocketConnection : Connection
{
private Socket clientSock;
private Socket socket;
this(Socket socket)
this(Server server, Socket socket)
{
clientSock = socket;
super(server);
this.socket = socket;
}
public override void handler()