Skip to content

Commit

Permalink
feat: Enables stream resumption.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho committed Dec 2, 2024
1 parent 96ed31f commit 39d568d
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions jicoco/src/main/java/org/jitsi/xmpp/mucclient/MucClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public class MucClient

static
{
XMPPTCPConnection.setUseStreamManagementDefault(false);
XMPPTCPConnection.setUseStreamManagementResumptionDefault(false);
XMPPTCPConnection.setUseStreamManagementDefault(true);
XMPPTCPConnection.setUseStreamManagementResumptionDefault(true);
PingManager.setDefaultPingInterval(DEFAULT_PING_INTERVAL_SECONDS);
}

Expand Down Expand Up @@ -318,13 +318,25 @@ private void initializeConnectAndJoin()
public void connected(XMPPConnection xmppConnection)
{
mucClientManager.connected(MucClient.this);
logger.info("Connected.");

if (xmppConnection instanceof XMPPTCPConnection)
{
XMPPTCPConnection connection = (XMPPTCPConnection) xmppConnection;

logger.info("Connected. isSmEnabled:" + connection.isSmEnabled() +
" isSmAvailable:" + connection.isSmAvailable() +
" isSmResumptionPossible:" + connection.isSmResumptionPossible());
}
else
{
logger.info("Connected.");
}
}

@Override
public void authenticated(XMPPConnection xmppConnection, boolean b)
public void authenticated(XMPPConnection xmppConnection, boolean resumed)
{
logger.info("Authenticated, b=" + b);
logger.info("Authenticated, resumed=" + resumed);
}

@Override
Expand Down Expand Up @@ -664,7 +676,11 @@ private Callable<Boolean> getConnectAndLoginCallable()

try
{
joinMucs();
if (!(xmppConnection instanceof XMPPTCPConnection
&& ((XMPPTCPConnection)xmppConnection).streamWasResumed()))
{
joinMucs();
}
}
catch(Exception e)
{
Expand Down

0 comments on commit 39d568d

Please sign in to comment.