mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-25 15:59:41 +08:00
avoid potential race condition on configuration reload
This commit is contained in:
1 parent
98961ced0d
commit
206e00c933
1 file changed
+4
-1
+4
-1
@@ -961,8 +961,11 @@ void hashadd(struct hashtable *ht, const unsigned char* name, unsigned long valu
|
|||||||
struct hashentry * he;
|
struct hashentry * he;
|
||||||
unsigned index;
|
unsigned index;
|
||||||
|
|
||||||
if(!value||!name||!ht->hashtable||!ht->hashempty) return;
|
|
||||||
pthread_mutex_lock(&hash_mutex);
|
pthread_mutex_lock(&hash_mutex);
|
||||||
|
if(!value||!name||!ht->hashtable||!ht->hashempty){
|
||||||
|
pthread_mutex_unlock(&hash_mutex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
he = ht->hashempty;
|
he = ht->hashempty;
|
||||||
ht->hashempty = ht->hashempty->next;
|
ht->hashempty = ht->hashempty->next;
|
||||||
nametohash(name, he->hash);
|
nametohash(name, he->hash);
|
||||||
|
|||||||
Reference in new issue
Block a user