1
0
mirror of https://github.com/deavminet/dnetd synced 2024-09-21 17:53:39 +02:00

Set the worker thread for outbound server links

This commit is contained in:
Tristan B. Kildaire 2021-01-29 15:00:56 +02:00
parent 611d9a1cc2
commit d8f66aa271
3 changed files with 23 additions and 7 deletions

View File

@ -5,6 +5,7 @@ import dnetd.dconfig : DConfig, DLinkConfig;
import std.json; import std.json;
import std.exception; import std.exception;
import gogga; import gogga;
import dnetd.dlink : DLink, DMeyer;
void main(string[] args) void main(string[] args)
{ {
@ -76,14 +77,17 @@ void main(string[] args)
/* Now configure the the linking */ /* Now configure the the linking */
DLinkConfig linkConfig = DLinkConfig.getConfig(dserver, json["links"]); DLinkConfig linkConfig = DLinkConfig.getConfig(dserver, json["links"]);
/* TODO: COnfigure here */ /* Get all server links */
DLink[] serverLinks = linkConfig.getLinks();
/* Create a new Meyer */
/* TODO: Start meyer here (remove from inside DServer) */ /* Attach the Meyer to the server */
/* Start the server */ /* Start the server (TODO: This should start Meyer) */
dserver.startServer(); dserver.startServer();
} }
else else

View File

@ -135,7 +135,6 @@ public final class DLinkConfig
{ {
/* Server links */ /* Server links */
private DLink[] links; private DLink[] links;
private Address[] addresses;
public static DLinkConfig getConfig(DServer dserver, JSONValue linksBlock) public static DLinkConfig getConfig(DServer dserver, JSONValue linksBlock)
{ {
@ -170,7 +169,11 @@ public final class DLinkConfig
dlinkConfig.links ~= new DLink(server, name, parseAddress(address, port)); dlinkConfig.links ~= new DLink(server, name, parseAddress(address, port));
} }
return dlinkConfig; return dlinkConfig;
} }
public DLink[] getLinks()
{
return links;
}
} }

View File

@ -60,6 +60,9 @@ public final class DLink : Thread
*/ */
this(DServer server, string name, Address address) this(DServer server, string name, Address address)
{ {
/* Set the worker thread for outbound connections */
super(&outboundWorker);
/* Create an outbound connection */ /* Create an outbound connection */
/* TODO: Fuuuuuuuuuuuuuuuuuuuck handling of shit here bababooey and not in dconnection.d as we would have done below */ /* TODO: Fuuuuuuuuuuuuuuuuuuuck handling of shit here bababooey and not in dconnection.d as we would have done below */
@ -76,6 +79,12 @@ public final class DLink : Thread
// connection = new DConnection(); // connection = new DConnection();
} }
private void outboundWorker()
{
/* TODO: Implement me */
}
/** /**
* Constructs a DLink for an inbound peering * Constructs a DLink for an inbound peering
*/ */