skyformat99
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
38 additions and
35 deletions
-
src/n2n.c
|
|
@ -426,14 +426,15 @@ void resolve_cancel_thread (n2n_resolve_parameter_t *param) { |
|
|
|
uint8_t resolve_check (n2n_resolve_parameter_t *param, uint8_t requires_resolution, time_t now) { |
|
|
|
|
|
|
|
uint8_t ret = requires_resolution; /* if trylock fails, it still requires resolution */ |
|
|
|
|
|
|
|
#ifdef HAVE_PTHREAD |
|
|
|
if(param != NULL) { |
|
|
|
n2n_resolve_ip_sock_t *entry, *tmp_entry; |
|
|
|
n2n_sock_str_t sock_buf; |
|
|
|
|
|
|
|
// check_interval and last_check do not need to be guarded by the mutex because
|
|
|
|
// their values get changed and evaluated only here
|
|
|
|
|
|
|
|
|
|
|
|
if((now - param->last_checked > param->check_interval) || (requires_resolution)) { |
|
|
|
// try to lock access
|
|
|
|
if(pthread_mutex_trylock(¶m->access) == 0) { |
|
|
@ -469,7 +470,9 @@ uint8_t resolve_check (n2n_resolve_parameter_t *param, uint8_t requires_resoluti |
|
|
|
pthread_mutex_unlock(¶m->access); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|