mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 22:32:06 +01:00
Synchronize connect() and login()
Those methods being not synchronized was never an issue, but they should mutally exclusive and not be called multiple times concurrently.
This commit is contained in:
parent
4c218c96f6
commit
0bcd3d9356
1 changed files with 4 additions and 4 deletions
|
@ -348,7 +348,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws ConnectionException with detailed information about the failed connection.
|
* @throws ConnectionException with detailed information about the failed connection.
|
||||||
*/
|
*/
|
||||||
public void connect() throws SmackException, IOException, XMPPException {
|
public synchronized void connect() throws SmackException, IOException, XMPPException {
|
||||||
throwAlreadyConnectedExceptionIfAppropriate();
|
throwAlreadyConnectedExceptionIfAppropriate();
|
||||||
saslAuthentication.init();
|
saslAuthentication.init();
|
||||||
saslFeatureReceived.init();
|
saslFeatureReceived.init();
|
||||||
|
@ -392,7 +392,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* @throws SmackException if an error occurs somehwere else besides XMPP protocol level.
|
* @throws SmackException if an error occurs somehwere else besides XMPP protocol level.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void login() throws XMPPException, SmackException, IOException {
|
public synchronized void login() throws XMPPException, SmackException, IOException {
|
||||||
if (isAnonymous()) {
|
if (isAnonymous()) {
|
||||||
throwNotConnectedExceptionIfAppropriate();
|
throwNotConnectedExceptionIfAppropriate();
|
||||||
throwAlreadyLoggedInExceptionIfAppropriate();
|
throwAlreadyLoggedInExceptionIfAppropriate();
|
||||||
|
@ -418,7 +418,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @see #login
|
* @see #login
|
||||||
*/
|
*/
|
||||||
public void login(String username, String password) throws XMPPException, SmackException,
|
public synchronized void login(String username, String password) throws XMPPException, SmackException,
|
||||||
IOException {
|
IOException {
|
||||||
login(username, password, config.getResource());
|
login(username, password, config.getResource());
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @see #login
|
* @see #login
|
||||||
*/
|
*/
|
||||||
public void login(String username, String password, String resource) throws XMPPException,
|
public synchronized void login(String username, String password, String resource) throws XMPPException,
|
||||||
SmackException, IOException {
|
SmackException, IOException {
|
||||||
if (!config.allowNullOrEmptyUsername && StringUtils.isNullOrEmpty(username)) {
|
if (!config.allowNullOrEmptyUsername && StringUtils.isNullOrEmpty(username)) {
|
||||||
throw new IllegalArgumentException("Username must not be null or empty");
|
throw new IllegalArgumentException("Username must not be null or empty");
|
||||||
|
|
Loading…
Reference in a new issue