mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-25 07:42:06 +01:00
Always wait for stream features after authentication
The purpose of the "maybeCompressFeaturesReceived" synchronization point is to wait for the stream features after authentication. This is not really reflected by its name and furthermore its checkIfSuccessOrWait() method was only invoked if compression was enabled, but we always want to wait for the stream features after authentication. Hence move the call before the isCompressionEnabled() check and one layer up in the call stack. Fixes SMACK-846.
This commit is contained in:
parent
f6da386dea
commit
48e3127172
1 changed files with 6 additions and 1 deletions
|
@ -387,6 +387,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
SSLSession sslSession = secureSocket != null ? secureSocket.getSession() : null;
|
SSLSession sslSession = secureSocket != null ? secureSocket.getSession() : null;
|
||||||
saslAuthentication.authenticate(username, password, config.getAuthzid(), sslSession);
|
saslAuthentication.authenticate(username, password, config.getAuthzid(), sslSession);
|
||||||
|
|
||||||
|
// Wait for stream features after the authentication.
|
||||||
|
// TODO: The name of this synchronization point "maybeCompressFeaturesReceived" is not perfect. It should be
|
||||||
|
// renamed to "streamFeaturesAfterAuthenticationReceived".
|
||||||
|
maybeCompressFeaturesReceived.checkIfSuccessOrWait();
|
||||||
|
|
||||||
// If compression is enabled then request the server to use stream compression. XEP-170
|
// If compression is enabled then request the server to use stream compression. XEP-170
|
||||||
// recommends to perform stream compression before resource binding.
|
// recommends to perform stream compression before resource binding.
|
||||||
maybeEnableCompression();
|
maybeEnableCompression();
|
||||||
|
@ -859,7 +864,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
if (!config.isCompressionEnabled()) {
|
if (!config.isCompressionEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
maybeCompressFeaturesReceived.checkIfSuccessOrWait();
|
|
||||||
Compress.Feature compression = getFeature(Compress.Feature.ELEMENT, Compress.NAMESPACE);
|
Compress.Feature compression = getFeature(Compress.Feature.ELEMENT, Compress.NAMESPACE);
|
||||||
if (compression == null) {
|
if (compression == null) {
|
||||||
// Server does not support compression
|
// Server does not support compression
|
||||||
|
|
Loading…
Reference in a new issue