Start tasky on connect() call, instantiate a new Tasky engine in the libdnet ctor

This commit is contained in:
Tristan B. Velloza Kildaire 2022-05-20 19:02:41 +02:00
parent fdf8d0ba04
commit 3ca097152f
1 changed files with 9 additions and 7 deletions

View File

@ -4,7 +4,7 @@
*/ */
module libdnet.libdnet; module libdnet.libdnet;
import std.socket : Address; import std.socket : Address, Socket;
import tasky.engine : Engine; import tasky.engine : Engine;
public class Client public class Client
@ -31,6 +31,13 @@ public class Client
/* TODO: Initialize stuff here */ /* TODO: Initialize stuff here */
this.endpoint = endpoint; this.endpoint = endpoint;
/* Open socket here */
Socket sock = new Socket();
sock.connect(endpoint);
/* Initialize a new Tasky engine */
engine = new Engine(sock);
} }
@ -39,13 +46,8 @@ public class Client
*/ */
public void connect() public void connect()
{ {
/* FIXME: Don't start Tasky engine till we are actually connected (FIX in Tasky) */
/* Initialize a new Tasky engine */
//engine = new Engine();
/* Start the Tasky engine */ /* Start the Tasky engine */
//engine.start(); engine.start();
} }