Migrated connectionQueue addition code to addConnection()

This commit is contained in:
Tristan B. Kildaire 2020-09-28 11:56:59 +02:00
parent 5983f090e3
commit c7fd5a6d30
1 changed files with 20 additions and 8 deletions

View File

@ -117,15 +117,8 @@ public class DServer : Thread
/* Spawn a connection handler */
DConnection connection = new DConnection(this, socket);
/* Lock the connections list */
connectionLock.lock();
/* Add to the connection queue */
connectionQueue ~= connection;
writeln("Added new connection to queue "~to!(string)(connection));
/* Unlock the connections list */
connectionLock.unlock();
addConnection(connection);
}
}
@ -142,6 +135,25 @@ public class DServer : Thread
channelLock.unlock();
}
public void addConnection(DConnection connection)
{
/* Lock the connections list */
connectionLock.lock();
/* Add to the connection queue */
connectionQueue ~= connection;
writeln("Added new connection to queue "~to!(string)(connection));
/* Unlock the connections list */
connectionLock.unlock();
}
/* TODO Remove connection */
public void removeConnection(DConnection client)
{
}
public DChannel getChannelByName(string channelName)
{
/* The channel */