mirror of https://github.com/deavminet/dnetd.git
Pass DLinkCOnfig to DMeyer
This commit is contained in:
parent
f780df7c56
commit
90aeab8344
|
@ -47,8 +47,8 @@ public final class DConfig
|
|||
config.generalConfig = DGeneralConfig.getConfig(generalBlock);
|
||||
|
||||
/* Get the `links` block */
|
||||
//JSONValue linksBlock = json["links"];
|
||||
//config.linksConfig = DLinkConfig.getConfig(linksBlock);
|
||||
JSONValue linksBlock = json["links"];
|
||||
config.linksConfig = DLinkConfig.getConfig(linksBlock);
|
||||
}
|
||||
catch(JSONException e)
|
||||
{
|
||||
|
@ -108,7 +108,6 @@ public final class DGeneralConfig
|
|||
|
||||
/* Set the message of the day */
|
||||
config.motd = generalBlock["motd"].str();
|
||||
|
||||
}
|
||||
catch(JSONException e)
|
||||
{
|
||||
|
@ -132,5 +131,13 @@ public final class DGeneralConfig
|
|||
|
||||
public final class DLinkConfig
|
||||
{
|
||||
public static DLinkConfig getConfig(JSONValue linksBlocks)
|
||||
{
|
||||
DLinkConfig dlinkConfig;
|
||||
|
||||
|
||||
|
||||
|
||||
return dlinkConfig;
|
||||
}
|
||||
}
|
|
@ -377,9 +377,11 @@ public class DConnection : Thread
|
|||
else if(command == Command.LINK && !hasAuthed)
|
||||
{
|
||||
/* TODO: Implement me later */
|
||||
gprintln("Server is requesting a link...");
|
||||
|
||||
/* Check if this connection is a DLink'd one */
|
||||
//server.getMeyer().get
|
||||
gprintln("OurMeyer: "~to!(string)(server.getMeyer()));
|
||||
|
||||
|
||||
/* Set the type of this connection to `server` */
|
||||
|
@ -389,7 +391,7 @@ public class DConnection : Thread
|
|||
/* If `register` command (requires: unauthed, client) */
|
||||
else if(command == Command.REGISTER && !hasAuthed && connType == ConnectionType.CLIENT)
|
||||
{
|
||||
|
||||
/* TODO: Implement me */
|
||||
}
|
||||
/* If `join` command (requires: authed, client) */
|
||||
else if(command == Command.JOIN && hasAuthed && connType == ConnectionType.CLIENT)
|
||||
|
|
|
@ -5,6 +5,7 @@ import core.sync.mutex : Mutex;
|
|||
import std.stdio;
|
||||
import std.conv;
|
||||
import dnetd.dserver;
|
||||
import dnetd.dconfig;
|
||||
|
||||
/**
|
||||
* DLink
|
||||
|
@ -35,13 +36,14 @@ public final class DLink
|
|||
|
||||
public final class DMeyer
|
||||
{
|
||||
/* List of links (direct peers + additional information) */
|
||||
/* Direct peers */
|
||||
private DLink[] links;
|
||||
private Mutex linksMutex;
|
||||
|
||||
/* Associated server */
|
||||
private DServer server;
|
||||
|
||||
this(DServer server)
|
||||
this(DServer server, DLinkConfig linkConfig)
|
||||
{
|
||||
this.server = server;
|
||||
linksMutex = new Mutex();
|
||||
|
|
|
@ -154,7 +154,7 @@ public class DServer : Thread
|
|||
private void startServer()
|
||||
{
|
||||
/* Initialize the Meyer linking sub-system */
|
||||
meyerSS = new DMeyer(this);
|
||||
meyerSS = new DMeyer(this, config.getLinks());
|
||||
|
||||
/* Start the listener starter */
|
||||
start();
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"general" : {
|
||||
"binds" : [
|
||||
{
|
||||
"address" : "0.0.0.0",
|
||||
"port" : "5555"
|
||||
},
|
||||
{
|
||||
"address" : "::",
|
||||
"port" : "5556"
|
||||
},
|
||||
],
|
||||
"network" : "aBasedIRCNetwork",
|
||||
"name" : "MyBrandSpankingNewIRCServer",
|
||||
"motd" : "Welcome to my generic dnet chat server!"
|
||||
},
|
||||
|
||||
"links" : {
|
||||
"server1" : {
|
||||
"name" : "server2",
|
||||
"address" : "127.0.0.1",
|
||||
"port" : "6666"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"general" : {
|
||||
"binds" : [
|
||||
{
|
||||
"address" : "0.0.0.0",
|
||||
"port" : "6666"
|
||||
},
|
||||
{
|
||||
"address" : "::",
|
||||
"port" : "6667"
|
||||
}
|
||||
],
|
||||
"network" : "aBasedIRCNetwork",
|
||||
"name" : "MyBrandSpankingNewIRCServer",
|
||||
"motd" : "Welcome to my generic dnet chat server!"
|
||||
},
|
||||
|
||||
"links" : {
|
||||
"server1" : {
|
||||
"name" : "server1",
|
||||
"address" : "127.0.0.1",
|
||||
"port" : "5555"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue