Skip to content

Commit

Permalink
fixed deadlock issue when providing invalid login info
Browse files Browse the repository at this point in the history
deadlock is caused by calling xmpp->stop() when the client is not
connected yet. A simple check of the current state prevents this
problem.
  • Loading branch information
kvnwinata committed Aug 7, 2015
1 parent 1f27197 commit 7fd1c3e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ofxXMPP.cpp
Expand Up @@ -85,7 +85,9 @@ void ofxXMPP::conn_handler(xmpp_conn_t * const conn, const xmpp_conn_event_t sta
xmpp->mutex.unlock();
}else{
xmpp->mutex.unlock();
xmpp->stop();
if (((ofxXMPP*) userdata)->getConnectionState() == ofxXMPPConnected){ // without this check xmpp->stop will be caught in a deadlock
xmpp->stop();
}
}
xmpp->connectionState = ofxXMPPDisconnected;
}
Expand Down

0 comments on commit 7fd1c3e

Please sign in to comment.