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

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

View File

@ -56,7 +56,26 @@ public class DChannel
public void leave(DConnection client) 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() public override string toString()