From 372ddbfb49cdea71c47ba40089b84eba550bb5ac Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 6 Jan 2021 09:03:42 +0100 Subject: [PATCH] Revert "offline presences aborts session proposals. fixes #3943" This reverts commit f23016c967c87df28543b781b15780f1f877802e. --- .../services/XmppConnectionService.java | 45 +++++++++---------- .../xmpp/jingle/JingleConnectionManager.java | 31 +++---------- 2 files changed, 27 insertions(+), 49 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 3d172f458..0f2423f63 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -206,26 +206,23 @@ public class XmppConnectionService extends Service { } }; public DatabaseBackend databaseBackend; - private final ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger"); + private ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger"); private long mLastActivity = 0; - private final FileBackend fileBackend = new FileBackend(this); + private FileBackend fileBackend = new FileBackend(this); private MemorizingTrustManager mMemorizingTrustManager; - private final NotificationService mNotificationService = new NotificationService(this); - private final ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this); - private final ShortcutService mShortcutService = new ShortcutService(this); - private final AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false); - private final AtomicBoolean mForceForegroundService = new AtomicBoolean(false); - private final AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false); - private final AtomicReference ongoingCall = new AtomicReference<>(); - private final OnMessagePacketReceived mMessageParser = new MessageParser(this); - private final OnPresencePacketReceived mPresenceParser = new PresenceParser(this); - private final IqParser mIqParser = new IqParser(this); - private final MessageGenerator mMessageGenerator = new MessageGenerator(this); + private NotificationService mNotificationService = new NotificationService(this); + private ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this); + private ShortcutService mShortcutService = new ShortcutService(this); + private AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false); + private AtomicBoolean mForceForegroundService = new AtomicBoolean(false); + private AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false); + private AtomicReference ongoingCall = new AtomicReference<>(); + private OnMessagePacketReceived mMessageParser = new MessageParser(this); + private OnPresencePacketReceived mPresenceParser = new PresenceParser(this); + private IqParser mIqParser = new IqParser(this); + private MessageGenerator mMessageGenerator = new MessageGenerator(this); public OnContactStatusChanged onContactStatusChanged = (contact, online) -> { - if (!online) { - getJingleConnectionManager().failProposedSessions(contact.getAccount(), contact.getJid().asBareJid()); - } - final Conversation conversation = find(getConversations(), contact); + Conversation conversation = find(getConversations(), contact); if (conversation != null) { if (online) { if (contact.getPresences().size() == 1) { @@ -234,14 +231,14 @@ public class XmppConnectionService extends Service { } } }; - private final PresenceGenerator mPresenceGenerator = new PresenceGenerator(this); + private PresenceGenerator mPresenceGenerator = new PresenceGenerator(this); private List accounts; - private final JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this); - private final HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this); - private final AvatarService mAvatarService = new AvatarService(this); - private final MessageArchiveService mMessageArchiveService = new MessageArchiveService(this); - private final PushManagementService mPushManagementService = new PushManagementService(this); - private final QuickConversationsService mQuickConversationsService = new QuickConversationsService(this); + private JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this); + private HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this); + private AvatarService mAvatarService = new AvatarService(this); + private MessageArchiveService mMessageArchiveService = new MessageArchiveService(this); + private PushManagementService mPushManagementService = new PushManagementService(this); + private QuickConversationsService mQuickConversationsService = new QuickConversationsService(this); private final ConversationsFileObserver fileObserver = new ConversationsFileObserver( Environment.getExternalStorageDirectory().getAbsolutePath() ) { 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 778b254ea..178ac659c 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -361,7 +361,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); } } @@ -681,30 +681,11 @@ public class JingleConnectionManager extends AbstractConnectionManager { Log.d(Config.LOGTAG, "session proposal already at discovered. not going to fall back"); return; } - updateProposedSessionDiscovered(sessionProposal, target); - } - } - - public void updateProposedSessionDiscovered(RtpSessionProposal sessionProposal, final DeviceDiscoveryState target) { - this.rtpSessionProposals.put(sessionProposal, target); - final RtpEndUserState endUserState = target.toEndUserState(); - toneManager.transition(endUserState, sessionProposal.media); - mXmppConnectionService.notifyJingleRtpConnectionUpdate(sessionProposal.account, sessionProposal.with, sessionProposal.sessionId, endUserState); - Log.d(Config.LOGTAG, sessionProposal.account.getJid().asBareJid() + ": flagging session " + sessionProposal.sessionId + " as " + target); - } - - public void failProposedSessions(final Account account, Jid from) { - synchronized (this.rtpSessionProposals) { - for (Map.Entry entry : rtpSessionProposals.entrySet()) { - final RtpSessionProposal rtpSessionProposal = entry.getKey(); - final DeviceDiscoveryState state = entry.getValue(); - if (state != DeviceDiscoveryState.DISCOVERED) { - continue; - } - if (rtpSessionProposal.with.equals(from) && rtpSessionProposal.account.getJid().equals(account.getJid())) { - updateProposedSessionDiscovered(rtpSessionProposal, JingleConnectionManager.DeviceDiscoveryState.FAILED); - } - } + this.rtpSessionProposals.put(sessionProposal, target); + final RtpEndUserState endUserState = target.toEndUserState(); + toneManager.transition(endUserState, sessionProposal.media); + mXmppConnectionService.notifyJingleRtpConnectionUpdate(account, sessionProposal.with, sessionProposal.sessionId, endUserState); + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": flagging session " + sessionId + " as " + target); } }