1. Stream compression is now negotiated after authentication as defined in JEP-170.

2. Keep copy of ConnectionConfiguration to prevent future modifications.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3314 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2006-01-17 21:28:46 +00:00 committed by gato
parent b522c42c8b
commit 07f5fc9ef6
1 changed files with 16 additions and 5 deletions

View File

@ -284,12 +284,13 @@ public class XMPPConnection {
ioe); ioe);
} }
this.serviceName = config.getServiceName(); this.serviceName = config.getServiceName();
this.configuration = config; try {
init(); // Keep a copy to be sure that once the configuration has been passed to the
// If compression is enabled then request the server to use stream compression // constructor it cannot be modified
if (config.isCompressionEnabled()) { this.configuration = (ConnectionConfiguration) config.clone();
useCompression();
} }
catch (CloneNotSupportedException e) {}
init();
} }
/** /**
@ -442,6 +443,11 @@ public class XMPPConnection {
} }
} }
// If compression is enabled then request the server to use stream compression
if (configuration.isCompressionEnabled()) {
useCompression();
}
// Create the roster. // Create the roster.
this.roster = new Roster(this); this.roster = new Roster(this);
roster.reload(); roster.reload();
@ -497,6 +503,11 @@ public class XMPPConnection {
// Update the serviceName with the one returned by the server // Update the serviceName with the one returned by the server
this.serviceName = StringUtils.parseServer(response); this.serviceName = StringUtils.parseServer(response);
// If compression is enabled then request the server to use stream compression
if (configuration.isCompressionEnabled()) {
useCompression();
}
// Anonymous users can't have a roster. // Anonymous users can't have a roster.
roster = null; roster = null;