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

Added getName() function

This commit is contained in:
Tristan B. Kildaire 2021-01-30 14:11:29 +02:00
parent 3d8e2cc522
commit a8dc8fdd5b

View File

@ -222,6 +222,11 @@ public final class DLink : Thread
/* Save connection */ /* Save connection */
} }
public string getName()
{
return name;
}
} }
/* TODO: Remove this from here and put it in DServer */ /* TODO: Remove this from here and put it in DServer */
@ -256,6 +261,30 @@ public final class DMeyer
linksMutex = new Mutex(); 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() public DLink[] getLinks()
{ {
return links; return links;