diff options
| -rw-r--r-- | ot_accesslist.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ot_accesslist.c b/ot_accesslist.c index 2fc146c..7df503f 100644 --- a/ot_accesslist.c +++ b/ot_accesslist.c | |||
| @@ -54,10 +54,10 @@ struct ot_accesslist { | |||
| 54 | ot_time base; | 54 | ot_time base; |
| 55 | ot_accesslist *next; | 55 | ot_accesslist *next; |
| 56 | }; | 56 | }; |
| 57 | static ot_accesslist * g_accesslist = NULL; | 57 | static ot_accesslist * _Atomic g_accesslist = NULL; |
| 58 | #ifdef WANT_DYNAMIC_ACCESSLIST | 58 | #ifdef WANT_DYNAMIC_ACCESSLIST |
| 59 | static ot_accesslist * g_accesslist_add = NULL; | 59 | static ot_accesslist * _Atomic g_accesslist_add = NULL; |
| 60 | static ot_accesslist * g_accesslist_delete = NULL; | 60 | static ot_accesslist * _Atomic g_accesslist_delete = NULL; |
| 61 | #endif | 61 | #endif |
| 62 | 62 | ||
| 63 | /* Helpers to work on access lists */ | 63 | /* Helpers to work on access lists */ |
| @@ -232,7 +232,7 @@ static void * accesslist_worker( void * args ) { | |||
| 232 | 232 | ||
| 233 | #ifdef WANT_DYNAMIC_ACCESSLIST | 233 | #ifdef WANT_DYNAMIC_ACCESSLIST |
| 234 | static pthread_t thread_adder_id, thread_deleter_id; | 234 | static pthread_t thread_adder_id, thread_deleter_id; |
| 235 | static void * accesslist_adddel_worker(char * fifoname, ot_accesslist ** adding_to, ot_accesslist ** removing_from) { | 235 | static void * accesslist_adddel_worker(char * fifoname, ot_accesslist * _Atomic * adding_to, ot_accesslist * _Atomic * removing_from) { |
| 236 | struct stat st; | 236 | struct stat st; |
| 237 | 237 | ||
| 238 | if (!stat(fifoname, &st)) { | 238 | if (!stat(fifoname, &st)) { |
| @@ -297,13 +297,14 @@ printf("parsed info_hash %20s\n", info_hash); | |||
| 297 | } | 297 | } |
| 298 | } | 298 | } |
| 299 | } | 299 | } |
| 300 | accesslist_clean(*removing_from); | ||
| 301 | 300 | ||
| 302 | /* Simple case: there's no adding_to list yet, create one with one member */ | 301 | /* Simple case: there's no adding_to list yet, create one with one member */ |
| 303 | if (!*adding_to) { | 302 | if (!*adding_to) { |
| 304 | *adding_to = accesslist_make(NULL, 1); | 303 | ot_accesslist * accesslist_new = accesslist_make(NULL, 1); |
| 305 | if (*adding_to) | 304 | if (accesslist_new) { |
| 306 | memcpy((*adding_to)->list, info_hash, sizeof(ot_hash)); | 305 | memcpy(accesslist_new->list, info_hash, sizeof(ot_hash)); |
| 306 | *adding_to = accesslist_new; | ||
| 307 | } | ||
| 307 | } else { | 308 | } else { |
| 308 | int exactmatch = 0; | 309 | int exactmatch = 0; |
| 309 | ot_hash * insert_point = binary_search( info_hash, (*adding_to)->list, (*adding_to)->size, OT_HASH_COMPARE_SIZE, sizeof(ot_hash), &exactmatch ); | 310 | ot_hash * insert_point = binary_search( info_hash, (*adding_to)->list, (*adding_to)->size, OT_HASH_COMPARE_SIZE, sizeof(ot_hash), &exactmatch ); |
| @@ -320,7 +321,6 @@ printf("parsed info_hash %20s\n", info_hash); | |||
| 320 | } | 321 | } |
| 321 | } | 322 | } |
| 322 | } | 323 | } |
| 323 | accesslist_clean(*adding_to); | ||
| 324 | 324 | ||
| 325 | pthread_mutex_unlock(&g_accesslist_mutex); | 325 | pthread_mutex_unlock(&g_accesslist_mutex); |
| 326 | } | 326 | } |
