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

Added mutex for properties to isProperty and getProperty

This commit is contained in:
Tristan B. Kildaire 2020-10-20 09:57:50 +02:00
parent 3f3bf6071e
commit 8a7480e356

View File

@ -909,7 +909,14 @@ public class DConnection : Thread
*/ */
public void setProperty(string propertyName, string propertyValue) public void setProperty(string propertyName, string propertyValue)
{ {
/* Lock the properties store */
propertiesLock.lock();
/* Set the property's value */
properties[propertyName] = propertyValue; properties[propertyName] = propertyValue;
/* Unlock the properties store */
propertiesLock.unlock();
} }
/** /**
@ -918,7 +925,22 @@ public class DConnection : Thread
*/ */
public bool isProperty(string propertyName) public bool isProperty(string propertyName)
{ {
return cast(bool)(propertyName in properties); /**
* Whether or not the given property is a property
* of this user
*/
bool status;
/* Lock the properties store */
propertiesLock.lock();
/* Check for the property's existence */
status = cast(bool)(propertyName in properties);
/* Unlock the properties store */
propertiesLock.unlock();
return status;
} }
/** /**