diff --git a/source/app.d b/source/app.d index 85ac049..33711c0 100644 --- a/source/app.d +++ b/source/app.d @@ -72,6 +72,10 @@ void main(string[] args) /* Get all server links */ DLink[] serverLinks = linkConfig.getLinks(); + + + import std.conv : to; + 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); diff --git a/source/dnetd/dlink.d b/source/dnetd/dlink.d index 6c0286b..caa9490 100644 --- a/source/dnetd/dlink.d +++ b/source/dnetd/dlink.d @@ -19,11 +19,26 @@ import core.thread : Thread; */ public final class DLinkManager { - this(DServer server, DLink[] seedLinks) + + this(DServer server) { } + /** + * Goes through the DConnection[] array in DServer and returns + * all connections that are SERVER connections + */ + public DConnection[] getLinkedServers() + { + DConnection[] links; + + /* TODO: Implement me */ + + + return links; + } + } @@ -63,6 +78,9 @@ public final class DLink : Thread /* Set the worker thread for outbound connections */ super(&outboundWorker); + this.name = name; + this.address = address; + /* Create an outbound connection */ /* TODO: Fuuuuuuuuuuuuuuuuuuuck handling of shit here bababooey and not in dconnection.d as we would have done below */ @@ -76,7 +94,13 @@ public final class DLink : Thread private void initializeOutboundConnection() { /* Open a connection to the server */ - // connection = new DConnection(); + import std.socket; + + Socket socket = new Socket(address.addressFamily, SocketType.STREAM, ProtocolType.TCP); + socket.connect(address); + + + } private void outboundWorker() @@ -89,6 +113,12 @@ public final class DLink : Thread } + override public string toString() + { + return "Server: "~name~", Address: "~to!(string)(address); + } + + /** * Constructs a DLink for an inbound peering */