mirror of https://github.com/deavminet/dnetd-ng
Added Mutexes
This commit is contained in:
parent
d0aeb9bf63
commit
051595a377
|
@ -13,6 +13,7 @@ import dnetd.config : ConfigurationError, Configuration;
|
||||||
import std.container.slist : SList;
|
import std.container.slist : SList;
|
||||||
import dnetd.listeners.listeners : Listener;
|
import dnetd.listeners.listeners : Listener;
|
||||||
import dnetd.connection.connection : Connection;
|
import dnetd.connection.connection : Connection;
|
||||||
|
import core.sync.mutex : Mutex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an instance of a dnet server
|
* Represents an instance of a dnet server
|
||||||
|
@ -26,13 +27,15 @@ public final class Server
|
||||||
* Listeners
|
* Listeners
|
||||||
*/
|
*/
|
||||||
private SList!(Listener) listeners;
|
private SList!(Listener) listeners;
|
||||||
|
private Mutex listenersMutex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connected clients and servers
|
* Connected clients and servers
|
||||||
*
|
*
|
||||||
* Inbound and outbound
|
* Inbound and outbound
|
||||||
*/
|
*/
|
||||||
private SList!(Connection) connections;
|
private SList!(Connection) conns;
|
||||||
|
private Mutex connsMutex;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +44,13 @@ public final class Server
|
||||||
{
|
{
|
||||||
logger.log("Server instance '"~"PUT ID HERE"~"' starting up...");
|
logger.log("Server instance '"~"PUT ID HERE"~"' starting up...");
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize all locks for data
|
||||||
|
* structures
|
||||||
|
*/
|
||||||
|
connsMutex = new Mutex();
|
||||||
|
listeners = new Mutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rehash server configuration */
|
/* Rehash server configuration */
|
||||||
|
|
Loading…
Reference in New Issue