mirror of
https://github.com/deavminet/dnetd
synced 2024-09-21 09:43:37 +02:00
Added getName()
function
This commit is contained in:
parent
3d8e2cc522
commit
a8dc8fdd5b
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user