Skip to content

Commit

Permalink
Fix locks for operations with users waiting for authentication or acc…
Browse files Browse the repository at this point in the history
…outing start
  • Loading branch information
ValdikSS committed Nov 23, 2015
1 parent 6f9eef6 commit 0170eb3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions radiusplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,14 +843,14 @@ void * auth_user_pass_verify(void * c)

while (!context->getStopThread())
{
pthread_mutex_lock(context->getMutexSend());
if (context->UserWaitingtoAuth()==false)
{
if ( DEBUG ( context->getVerbosity() ) ) cerr << getTime() << "RADIUS-PLUGIN: FOREGROUND THREAD: Waiting for new user." << endl;
cout.flush();
pthread_mutex_lock(context->getMutexSend());
pthread_cond_wait(context->getCondSend(),context->getMutexSend());
pthread_mutex_unlock(context->getMutexSend());
}
pthread_mutex_unlock(context->getMutexSend());
if (context->getStopThread()==true)
{
cerr << getTime() << "RADIUS-PLUGIN: FOREGROUND THREAD: Stop signal received." << endl;
Expand Down Expand Up @@ -1076,14 +1076,14 @@ void * client_connect(void * c)

while (!context->getStopThread())
{
pthread_mutex_lock(context->getAcctMutexSend());
if (context->UserWaitingtoAcct()==false)
{
if ( DEBUG ( context->getVerbosity() ) ) cerr << getTime() << "RADIUS-PLUGIN: FOREGROUND THREAD: Waiting for new accounting user." << endl;
cout.flush();
pthread_mutex_lock(context->getAcctMutexSend());
pthread_cond_wait(context->getAcctCondSend(),context->getAcctMutexSend());
pthread_mutex_unlock(context->getAcctMutexSend());
}
pthread_mutex_unlock(context->getAcctMutexSend());
if (context->getStopThread()==true)
{
cerr << getTime() << "RADIUS-PLUGIN: FOREGROUND THREAD: Stop signal received." << endl;
Expand Down

0 comments on commit 0170eb3

Please sign in to comment.