This prevents the recursive mutex problem on some platforms.
memset(handler, 0, sizeof(EAP_HANDLER));
if (fr_debug_flag && inst->handler_tree) {
memset(handler, 0, sizeof(EAP_HANDLER));
if (fr_debug_flag && inst->handler_tree) {
- pthread_mutex_lock(&(inst->session_mutex));
+ pthread_mutex_lock(&(inst->handler_mutex));
rbtree_insert(inst->handler_tree, handler);
rbtree_insert(inst->handler_tree, handler);
- pthread_mutex_unlock(&(inst->session_mutex));
+ pthread_mutex_unlock(&(inst->handler_mutex));
return;
if (inst->handler_tree) {
return;
if (inst->handler_tree) {
- pthread_mutex_lock(&(inst->session_mutex));
+ pthread_mutex_lock(&(inst->handler_mutex));
rbtree_deletebydata(inst->handler_tree, handler);
rbtree_deletebydata(inst->handler_tree, handler);
- pthread_mutex_unlock(&(inst->session_mutex));
+ pthread_mutex_unlock(&(inst->handler_mutex));
}
if (handler->identity) {
}
if (handler->identity) {
}
pthread_mutex_destroy(&(inst->session_mutex));
}
pthread_mutex_destroy(&(inst->session_mutex));
+ if (fr_debug_flag) pthread_mutex_destroy(&(inst->handler_mutex));
eap_detach(inst);
return -1;
}
eap_detach(inst);
return -1;
}
+
+ if (pthread_mutex_init(&(inst->handler_mutex), NULL) < 0) {
+ radlog(L_ERR|L_CONS, "rlm_eap: Failed initializing mutex: %s", strerror(errno));
+ eap_detach(inst);
+ return -1;
+ }
- pthread_mutex_init(&(inst->session_mutex), NULL);
+ if (pthread_mutex_init(&(inst->session_mutex), NULL) < 0) {
+ radlog(L_ERR|L_CONS, "rlm_eap: Failed initializing mutex: %s", strerror(errno));
+ eap_detach(inst);
+ return -1;
+ }
*instance = inst;
return 0;
*instance = inst;
return 0;
#ifdef HAVE_PTHREAD_H
pthread_mutex_t session_mutex;
#ifdef HAVE_PTHREAD_H
pthread_mutex_t session_mutex;
+ pthread_mutex_t handler_mutex;
#endif
const char *xlat_name; /* no xlat's yet */
#endif
const char *xlat_name; /* no xlat's yet */