mirror of
https://github.com/deavminet/dnetd
synced 2024-09-21 09:43:37 +02:00
Moved code for outbound server linking to DServer
This commit is contained in:
parent
ea36ba240d
commit
905ad50188
@ -85,13 +85,6 @@ void main(string[] args)
|
||||
|
||||
/* Start the server (TODO: This should start Meyer) */
|
||||
dserver.startServer();
|
||||
|
||||
/* Start all DLink outbound handlers (TODO: Move to DServer) */
|
||||
foreach(DLink link; serverLinks)
|
||||
{
|
||||
link.start();
|
||||
}
|
||||
|
||||
}
|
||||
catch(JSONException e)
|
||||
{
|
||||
|
@ -175,6 +175,9 @@ public final class DMeyer
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -191,18 +194,8 @@ public final class DMeyer
|
||||
linksMutex = new Mutex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a peer to the links list
|
||||
*/
|
||||
public void addLink(DLink newLink)
|
||||
public DLink[] getOutboundLinks()
|
||||
{
|
||||
/* Lock the list */
|
||||
linksMutex.lock();
|
||||
|
||||
/* Add the link */
|
||||
links ~= newLink;
|
||||
|
||||
/* Unlock the list */
|
||||
linksMutex.unlock();
|
||||
return links;
|
||||
}
|
||||
}
|
||||
|
@ -162,6 +162,27 @@ public class DServer : Thread
|
||||
{
|
||||
/* Start the listener starter */
|
||||
start();
|
||||
|
||||
/* Start outbound server linking */
|
||||
startOutboundLinks();
|
||||
gprintln("poes");
|
||||
}
|
||||
|
||||
/**
|
||||
* This will look at the link manager (DMeyer)
|
||||
* and loop through each DLink in it and
|
||||
* establish an outbound connection and therefore
|
||||
* connection handler for each of them
|
||||
*/
|
||||
private void startOutboundLinks()
|
||||
{
|
||||
DLink[] serverLinks = meyerSS.getOutboundLinks();
|
||||
|
||||
/* Start all DLink outbound handlers (TODO: Move to DServer) */
|
||||
foreach(DLink link; serverLinks)
|
||||
{
|
||||
link.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void addChannel(DConnection causer, DChannel channel)
|
||||
|
Loading…
Reference in New Issue
Block a user