mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 12:10:53 +03:00
tpws: resolver_deinit clear list
This commit is contained in:
parent
103419302f
commit
747f9676a6
@ -38,6 +38,19 @@ static t_resolver resolver = { .bInit = false };
|
|||||||
#define rlist_lock pthread_mutex_lock(&resolver.resolve_list_lock)
|
#define rlist_lock pthread_mutex_lock(&resolver.resolve_list_lock)
|
||||||
#define rlist_unlock pthread_mutex_unlock(&resolver.resolve_list_lock)
|
#define rlist_unlock pthread_mutex_unlock(&resolver.resolve_list_lock)
|
||||||
|
|
||||||
|
static void resolver_clear_list(void)
|
||||||
|
{
|
||||||
|
struct resolve_item *ri;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
ri = TAILQ_FIRST(&resolver.resolve_list);
|
||||||
|
if (!ri) break;
|
||||||
|
TAILQ_REMOVE(&resolver.resolve_list, ri, next);
|
||||||
|
free(ri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int resolver_thread_count(void)
|
int resolver_thread_count(void)
|
||||||
{
|
{
|
||||||
return resolver.bInit ? resolver.threads : 0;
|
return resolver.bInit ? resolver.threads : 0;
|
||||||
@ -187,6 +200,7 @@ ex1:
|
|||||||
pthread_mutex_destroy(&resolver.resolve_list_lock);
|
pthread_mutex_destroy(&resolver.resolve_list_lock);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resolver_deinit(void)
|
void resolver_deinit(void)
|
||||||
{
|
{
|
||||||
if (resolver.bInit)
|
if (resolver.bInit)
|
||||||
@ -211,6 +225,8 @@ void resolver_deinit(void)
|
|||||||
sem_destroy(resolver.sem);
|
sem_destroy(resolver.sem);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
resolver_clear_list();
|
||||||
|
|
||||||
memset(&resolver,0,sizeof(resolver));
|
memset(&resolver,0,sizeof(resolver));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user