mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 18:59:41 +02:00
1) Fixed reconnection when connection was using compression.
2) Fixed conflict error while reconnecting (reconnection was not keeping track of resource and sendPresence. 3) Improved javadoc (and checking) that reconnectionlisteners should be added once connected. 4) Added new reconnection test case for reconnection and multiple resources. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6050 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
97824ebc1c
commit
53c97378d3
3 changed files with 82 additions and 12 deletions
|
@ -442,7 +442,7 @@ public class XMPPConnection {
|
|||
anonymous = false;
|
||||
|
||||
// Stores the autentication for future reconnection
|
||||
this.getConfiguration().setUsernameAndPassword(username, password);
|
||||
this.getConfiguration().setLoginInfo(username, password, resource, sendPresence);
|
||||
|
||||
// If debugging is enabled, change the the debug window title to include the
|
||||
// name we are now logged-in as.
|
||||
|
@ -785,11 +785,15 @@ public class XMPPConnection {
|
|||
|
||||
/**
|
||||
* Adds a connection listener to this connection that will be notified when
|
||||
* the connection closes or fails.
|
||||
* the connection closes or fails. The connection needs to already be connected
|
||||
* or otherwise an IllegalStateException will be thrown.
|
||||
*
|
||||
* @param connectionListener a connection listener.
|
||||
*/
|
||||
public void addConnectionListener(ConnectionListener connectionListener) {
|
||||
if (!isConnected()) {
|
||||
throw new IllegalStateException("Not connected to server.");
|
||||
}
|
||||
if (connectionListener == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -885,12 +889,15 @@ public class XMPPConnection {
|
|||
* @throws XMPPException if establishing a connection to the server fails.
|
||||
*/
|
||||
private void initConnection() throws XMPPException {
|
||||
boolean isFirstInitialization = packetReader == null || packetWriter == null;
|
||||
if (!isFirstInitialization) {
|
||||
usingCompression = false;
|
||||
}
|
||||
|
||||
// Set the reader and writer instance variables
|
||||
initReaderAndWriter();
|
||||
|
||||
try {
|
||||
boolean isFirstInitialization = packetReader == null || packetWriter == null;
|
||||
|
||||
if (isFirstInitialization) {
|
||||
packetWriter = new PacketWriter(this);
|
||||
packetReader = new PacketReader(this);
|
||||
|
@ -1342,7 +1349,8 @@ public class XMPPConnection {
|
|||
// Make the anonymous login
|
||||
loginAnonymously();
|
||||
} else {
|
||||
login(getConfiguration().getUsername(), getConfiguration().getPassword());
|
||||
login(getConfiguration().getUsername(), getConfiguration().getPassword(),
|
||||
getConfiguration().getResource(), getConfiguration().isSendPresence());
|
||||
}
|
||||
} catch (XMPPException e) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue