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

Fixed compilation error

This commit is contained in:
Tristan B. Kildaire 2020-09-28 12:50:40 +02:00
parent c7fd5a6d30
commit 98700f3067
2 changed files with 25 additions and 4 deletions

View File

@ -154,7 +154,7 @@ public class DConnection : Thread
} }
/* Remove this user from the connection queue */ /* Remove this user from the connection queue */
/* TODO: Implement me */ server.removeConnection(this);
} }
/* TODO: add mutex for writing with message and funciton for doing so */ /* TODO: add mutex for writing with message and funciton for doing so */

View File

@ -142,16 +142,37 @@ public class DServer : Thread
/* Add to the connection queue */ /* Add to the connection queue */
connectionQueue ~= connection; connectionQueue ~= connection;
writeln("Added new connection to queue "~to!(string)(connection)); writeln("Added connection to queue "~to!(string)(connection));
/* Unlock the connections list */ /* Unlock the connections list */
connectionLock.unlock(); connectionLock.unlock();
} }
/* TODO Remove connection */ /* TODO Remove connection */
public void removeConnection(DConnection client) public void removeConnection(DConnection connection)
{ {
/* Lock the connections list */
connectionLock.lock();
/* The new connection queue */
DConnection[] connectionQueueNew;
foreach(DConnection currentConnection; connectionQueue)
{
if(!(currentConnection is connection))
{
connectionQueueNew ~= currentConnection;
}
}
/* Set this as the new queue */
connectionQueue = connectionQueueNew;
/* TODO: Implement removal */
writeln("Remove connection from queue "~to!(string)(connection));
/* Unlock the connections list */
connectionLock.unlock();
} }
public DChannel getChannelByName(string channelName) public DChannel getChannelByName(string channelName)