mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-24 15:22:07 +01:00
[tcp] Set sync points before they are used, and not in init()
This commit is contained in:
parent
843c8dd7fe
commit
fd1b49ca8f
1 changed files with 6 additions and 9 deletions
|
@ -364,6 +364,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
SmackException, IOException, InterruptedException {
|
||||
// Authenticate using SASL
|
||||
SSLSession sslSession = secureSocket != null ? secureSocket.getSession() : null;
|
||||
|
||||
streamFeaturesAfterAuthenticationReceived = false;
|
||||
authenticate(username, password, config.getAuthzid(), sslSession);
|
||||
|
||||
// Wait for stream features after the authentication.
|
||||
|
@ -375,6 +377,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
// recommends to perform stream compression before resource binding.
|
||||
maybeEnableCompression();
|
||||
|
||||
smResumedSyncPoint = SyncPointState.initial;
|
||||
smResumptionFailed = null;
|
||||
if (isSmResumptionPossible()) {
|
||||
smResumedSyncPoint = SyncPointState.request_sent;
|
||||
sendNonza(new Resume(clientHandledStanzasCount, smSessionId));
|
||||
|
@ -409,6 +413,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
// unacknowledgedStanzas and become duplicated on reconnect. See SMACK-706.
|
||||
bindResourceAndEstablishSession(resource);
|
||||
|
||||
smEnabledSyncPoint = false;
|
||||
if (isSmAvailable() && useSm) {
|
||||
// Remove what is maybe left from previously stream managed sessions
|
||||
serverHandledStanzasCount = 0;
|
||||
|
@ -535,15 +540,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
initState();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initState() {
|
||||
super.initState();
|
||||
streamFeaturesAfterAuthenticationReceived = compressSyncPoint = false;
|
||||
smResumedSyncPoint = SyncPointState.initial;
|
||||
smResumptionFailed = null;
|
||||
smEnabledSyncPoint = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendNonza(Nonza element) throws NotConnectedException, InterruptedException {
|
||||
packetWriter.sendStreamElement(element);
|
||||
|
@ -794,6 +790,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
// If stream compression was offered by the server and we want to use
|
||||
// compression then send compression request to the server
|
||||
if ((compressionHandler = maybeGetCompressionHandler(compression)) != null) {
|
||||
compressSyncPoint = false;
|
||||
sendNonza(new Compress(compressionHandler.getCompressionMethod()));
|
||||
waitForConditionOrThrowConnectionException(() -> compressSyncPoint, "establishing stream compression");
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue