From db447f845e191ea10f9b5011f3bc9d495a34608e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 12 Feb 2021 11:36:44 +0100 Subject: [PATCH] resend session proposal on rebind --- .../services/XmppConnectionService.java | 3 ++- .../xmpp/jingle/JingleConnectionManager.java | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index bd409da8d..f02a4cde2 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -344,7 +344,7 @@ public class XmppConnectionService extends Service { synchronized (account.inProgressConferencePings) { account.inProgressConferencePings.clear(); } - mJingleConnectionManager.notifyRebound(); + mJingleConnectionManager.notifyRebound(account); mQuickConversationsService.considerSyncBackground(false); fetchRosterFromServer(account); @@ -370,6 +370,7 @@ public class XmppConnectionService extends Service { } connectMultiModeConversations(account); syncDirtyContacts(account); + } }; private final AtomicLong mLastExpiryRun = new AtomicLong(0); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java index 8dddbe3d5..5e9925aca 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -364,7 +364,7 @@ public class JingleConnectionManager extends AbstractConnectionManager { } } } else { - Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": retrieved out of order jingle message"+message); + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": retrieved out of order jingle message" + message); } } @@ -605,7 +605,6 @@ public class JingleConnectionManager extends AbstractConnectionManager { RtpEndUserState.FINDING_DEVICE ); final MessagePacket messagePacket = mXmppConnectionService.getMessageGenerator().sessionProposal(proposal); - Log.d(Config.LOGTAG, messagePacket.toString()); mXmppConnectionService.sendMessagePacket(account, messagePacket); } } @@ -657,10 +656,11 @@ public class JingleConnectionManager extends AbstractConnectionManager { account.getXmppConnection().sendIqPacket(packet.generateResponse(IqPacket.TYPE.ERROR), null); } - public void notifyRebound() { + public void notifyRebound(final Account account) { for (final AbstractJingleConnection connection : this.connections.values()) { connection.notifyRebound(); } + resendSessionProposals(account); } public WeakReference findJingleRtpConnection(Account account, Jid with, String sessionId) { @@ -672,6 +672,19 @@ public class JingleConnectionManager extends AbstractConnectionManager { return null; } + private void resendSessionProposals(final Account account) { + synchronized (this.rtpSessionProposals) { + for (final Map.Entry entry : this.rtpSessionProposals.entrySet()) { + final RtpSessionProposal proposal = entry.getKey(); + if (entry.getValue() == DeviceDiscoveryState.SEARCHING && proposal.account == account) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": resending session proposal to " + proposal.with); + final MessagePacket messagePacket = mXmppConnectionService.getMessageGenerator().sessionProposal(proposal); + mXmppConnectionService.sendMessagePacket(account, messagePacket); + } + } + } + } + public void updateProposedSessionDiscovered(Account account, Jid from, String sessionId, final DeviceDiscoveryState target) { synchronized (this.rtpSessionProposals) { final RtpSessionProposal sessionProposal = getRtpSessionProposal(account, from.asBareJid(), sessionId);