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

Cleaned up

This commit is contained in:
Tristan B. Kildaire 2021-01-30 16:39:47 +02:00
parent 1e3ca829fb
commit 6e75f84ba5
2 changed files with 22 additions and 9 deletions

View File

@ -180,6 +180,9 @@ public class DConnection : Thread
/* Leave all channels this connetion was a member of */
cleanUp_channels();
/* Delink this connection from this server */
cleanUp_delinkServers();
/* Remove this user from the connection queue */
server.removeConnection(this);
@ -214,6 +217,20 @@ public class DConnection : Thread
gprintln(to!(string)(this)~" Leaving all channels... [done]");
}
/**
* Part of the clean up process - `cleanUp()`
*
* Will de-link Will leave all channels this connection is
* a member of
*/
private void cleanUp_delinkServers()
{
if(connType == ConnectionType.SERVER)
{
}
}
/* TODO: add mutex for writing with message and funciton for doing so */
/**
@ -412,7 +429,7 @@ public class DConnection : Thread
/* Add to the meyer system (this connectio) */
import dnetd.dlink : DLink;
DLink newLink = new DLink(server, serverNameIncoming, null, this);
DLink newLink = new DLink(server, serverNameIncoming, this);
bool linkSuccessful = server.getMeyer().attachLink(serverNameIncoming, newLink);
gprintln("Whether or not the link worked out (could be config error or possibly duplicate link): "~to!(string)(linkSuccessful));

View File

@ -211,20 +211,16 @@ public final class DLink : Thread
override public string toString()
{
return name;
// return "Server: "~name~", Address: "~to!(string)(address);
}
/**
* Constructs a DLink for an inbound peering
*/
this(DServer server, string name, Address address, DConnection connection)
this(DServer server, string name, DConnection connection)
{
/* Save the server, name and address */
/* Save the active connection */
/* Save name and address */
this(server, name, address);
/* Save the server and name */
this(server, name, address=null);
/* Save connection */
//this.connection = connection;
@ -269,7 +265,7 @@ public final class DMeyer : Thread
linksMutex.lock();
gprintln("Linked servers: "~to!(string)(links), DebugType.WARNING);
linksMutex.unlock();
Thread.sleep(dur!("seconds")(3));
}
}