Implemented DChannel.leave(this, DConnection)

This commit is contained in:
Tristan B. Kildaire 2020-09-24 00:28:15 +02:00
parent 9409cdf507
commit a606b19742
1 changed files with 20 additions and 1 deletions

View File

@ -56,7 +56,26 @@ public class DChannel
public void leave(DConnection client)
{
/* Lock the members list */
memberLock.lock();
/* TODO: Get a better implementation */
/* Create a new list without the `client` */
DConnection[] newMembers;
foreach(DConnection currentMember; members)
{
if(!(currentMember is client))
{
newMembers ~= currentMember;
}
}
/* Set it as the new list */
members = newMembers;
/* Unlock the members list */
memberLock.unlock();
}
public override string toString()