diff --git a/source/app.d b/source/app.d index 14db750..105c9e3 100644 --- a/source/app.d +++ b/source/app.d @@ -78,7 +78,7 @@ void main(string[] args) gprintln("Links I will be opening: " ~to!(string)(serverLinks)); /* Create a new Meyer (link manager) and attach the links to it */ - DMeyer meyer = new DMeyer(dserver, serverLinks); + DMeyer meyer = new DMeyer(dserver); /* Attach the Meyer to the server */ dserver.attachLinkManager(meyer); diff --git a/source/dnetd/dlink.d b/source/dnetd/dlink.d index 331b906..8f64fda 100644 --- a/source/dnetd/dlink.d +++ b/source/dnetd/dlink.d @@ -210,7 +210,8 @@ public final class DLink : Thread override public string toString() { - return "Server: "~name~", Address: "~to!(string)(address); + return name; + // return "Server: "~name~", Address: "~to!(string)(address); } @@ -235,7 +236,7 @@ public final class DLink : Thread } /* TODO: Remove this from here and put it in DServer */ -public final class DMeyer +public final class DMeyer : Thread { /* Direct peers */ private DLink[] links; @@ -244,21 +245,29 @@ public final class DMeyer /* Associated server */ private DServer server; - this(DServer server, DLink[] links) + this(DServer server) { + super(&worker); + + /* save shit */ this.server = server; /* Initialize the locks */ initLocks(); - /* Open a connection to the server */ - - /* TODO: Open connections to all servers we are yet to open a connection to (check the `links` array) */ - - - //this.links = links; + start(); } + private void worker() + { + while(true) + { + linksMutex.lock(); + gprintln("Linked servers: "~to!(string)(links), DebugType.WARNING); + linksMutex.unlock(); + Thread.sleep(dur!("seconds")(3)); + } + } /* Initialize locks */ private void initLocks()