|
@ -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 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 */ |
|
|
uint8_t ret = requires_resolution; /* if trylock fails, it still requires resolution */ |
|
|
|
|
|
|
|
|
#ifdef HAVE_PTHREAD |
|
|
#ifdef HAVE_PTHREAD |
|
|
|
|
|
if(param != NULL) { |
|
|
n2n_resolve_ip_sock_t *entry, *tmp_entry; |
|
|
n2n_resolve_ip_sock_t *entry, *tmp_entry; |
|
|
n2n_sock_str_t sock_buf; |
|
|
n2n_sock_str_t sock_buf; |
|
|
|
|
|
|
|
|
// check_interval and last_check do not need to be guarded by the mutex because
|
|
|
// check_interval and last_check do not need to be guarded by the mutex because
|
|
|
// their values get changed and evaluated only here
|
|
|
// their values get changed and evaluated only here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if((now - param->last_checked > param->check_interval) || (requires_resolution)) { |
|
|
if((now - param->last_checked > param->check_interval) || (requires_resolution)) { |
|
|
// try to lock access
|
|
|
// try to lock access
|
|
|
if(pthread_mutex_trylock(¶m->access) == 0) { |
|
|
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); |
|
|
pthread_mutex_unlock(¶m->access); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
return ret; |
|
|
return ret; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|