diff --git a/source/dnetd/dlink.d b/source/dnetd/dlink.d index a2c50ff..3ece2f2 100644 --- a/source/dnetd/dlink.d +++ b/source/dnetd/dlink.d @@ -222,6 +222,11 @@ public final class DLink : Thread /* Save connection */ } + + public string getName() + { + return name; + } } /* TODO: Remove this from here and put it in DServer */ @@ -256,6 +261,30 @@ public final class DMeyer linksMutex = new Mutex(); } + public bool attachLink(string serverName, DLink link) + { + /* Link exists? */ + bool linkGood = true; + + /* Lock the links list */ + linksMutex.lock(); + + /* Search for this entry, only add it if it doens't exist */ + foreach(DLink link; links) + { + if(cmp(link.getName(), serverName) == 0) + { + linkGood = false; + break; + } + } + + /* Unlock the links list */ + linksMutex.unlock(); + + return linkGood; + } + public DLink[] getLinks() { return links;