Skip to content

Commit

Permalink
fix: Do not send presence unavailable after a failure. (#192)
Browse files Browse the repository at this point in the history
Attempts to address jitsi/jitsi-videobridge#2052 by not sending presence
unavailable when disconnecting due to a connection failure. If the TCP
connection is alive then the server will notice that it's closed. If it
isn't alive then it won't matter anyway.
  • Loading branch information
bgrozev committed Nov 7, 2023
1 parent bebfb15 commit 23ac61c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions jicoco/src/main/java/org/jitsi/xmpp/mucclient/MucClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ private Callable<Boolean> getConnectAndLoginCallable()
// login (because the locally cached SASL mechanisms supported by the server are empty). We
// disconnect in order to trigger a re-connect and clear that state on the next attempt.
logger.warn("Failed to login. Disconnecting to trigger a re-connect.", e);
xmppConnection.disconnect();
xmppConnection.disconnect(null);
return true;
}

Expand Down Expand Up @@ -871,7 +871,14 @@ public void pingFailed()
// This is a weird situation that we have seen in the past when using VPN.
// Everything stays like this forever as the socket remains open on the OS level
// and it is never dropped. We will trigger reconnect just in case.
xmppConnection.disconnect();
try
{
xmppConnection.disconnect(null);
}
catch (Exception e)
{
logger.warn("Exception while disconnecting");
}
}
}
}
Expand Down

0 comments on commit 23ac61c

Please sign in to comment.