offline presences aborts session proposals. fixes #3943
This commit is contained in:
parent
b4db2e5284
commit
f23016c967
|
@ -206,23 +206,26 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public DatabaseBackend databaseBackend;
|
public DatabaseBackend databaseBackend;
|
||||||
private ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger");
|
private final ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger");
|
||||||
private long mLastActivity = 0;
|
private long mLastActivity = 0;
|
||||||
private FileBackend fileBackend = new FileBackend(this);
|
private final FileBackend fileBackend = new FileBackend(this);
|
||||||
private MemorizingTrustManager mMemorizingTrustManager;
|
private MemorizingTrustManager mMemorizingTrustManager;
|
||||||
private NotificationService mNotificationService = new NotificationService(this);
|
private final NotificationService mNotificationService = new NotificationService(this);
|
||||||
private ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this);
|
private final ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this);
|
||||||
private ShortcutService mShortcutService = new ShortcutService(this);
|
private final ShortcutService mShortcutService = new ShortcutService(this);
|
||||||
private AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false);
|
private final AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false);
|
||||||
private AtomicBoolean mForceForegroundService = new AtomicBoolean(false);
|
private final AtomicBoolean mForceForegroundService = new AtomicBoolean(false);
|
||||||
private AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false);
|
private final AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false);
|
||||||
private AtomicReference<OngoingCall> ongoingCall = new AtomicReference<>();
|
private final AtomicReference<OngoingCall> ongoingCall = new AtomicReference<>();
|
||||||
private OnMessagePacketReceived mMessageParser = new MessageParser(this);
|
private final OnMessagePacketReceived mMessageParser = new MessageParser(this);
|
||||||
private OnPresencePacketReceived mPresenceParser = new PresenceParser(this);
|
private final OnPresencePacketReceived mPresenceParser = new PresenceParser(this);
|
||||||
private IqParser mIqParser = new IqParser(this);
|
private final IqParser mIqParser = new IqParser(this);
|
||||||
private MessageGenerator mMessageGenerator = new MessageGenerator(this);
|
private final MessageGenerator mMessageGenerator = new MessageGenerator(this);
|
||||||
public OnContactStatusChanged onContactStatusChanged = (contact, online) -> {
|
public OnContactStatusChanged onContactStatusChanged = (contact, online) -> {
|
||||||
Conversation conversation = find(getConversations(), contact);
|
if (!online) {
|
||||||
|
getJingleConnectionManager().failProposedSessions(contact.getAccount(), contact.getJid().asBareJid());
|
||||||
|
}
|
||||||
|
final Conversation conversation = find(getConversations(), contact);
|
||||||
if (conversation != null) {
|
if (conversation != null) {
|
||||||
if (online) {
|
if (online) {
|
||||||
if (contact.getPresences().size() == 1) {
|
if (contact.getPresences().size() == 1) {
|
||||||
|
@ -231,14 +234,14 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private PresenceGenerator mPresenceGenerator = new PresenceGenerator(this);
|
private final PresenceGenerator mPresenceGenerator = new PresenceGenerator(this);
|
||||||
private List<Account> accounts;
|
private List<Account> accounts;
|
||||||
private JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this);
|
private final JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this);
|
||||||
private HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this);
|
private final HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this);
|
||||||
private AvatarService mAvatarService = new AvatarService(this);
|
private final AvatarService mAvatarService = new AvatarService(this);
|
||||||
private MessageArchiveService mMessageArchiveService = new MessageArchiveService(this);
|
private final MessageArchiveService mMessageArchiveService = new MessageArchiveService(this);
|
||||||
private PushManagementService mPushManagementService = new PushManagementService(this);
|
private final PushManagementService mPushManagementService = new PushManagementService(this);
|
||||||
private QuickConversationsService mQuickConversationsService = new QuickConversationsService(this);
|
private final QuickConversationsService mQuickConversationsService = new QuickConversationsService(this);
|
||||||
private final ConversationsFileObserver fileObserver = new ConversationsFileObserver(
|
private final ConversationsFileObserver fileObserver = new ConversationsFileObserver(
|
||||||
Environment.getExternalStorageDirectory().getAbsolutePath()
|
Environment.getExternalStorageDirectory().getAbsolutePath()
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -361,7 +361,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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,11 +681,30 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
Log.d(Config.LOGTAG, "session proposal already at discovered. not going to fall back");
|
Log.d(Config.LOGTAG, "session proposal already at discovered. not going to fall back");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
updateProposedSessionDiscovered(sessionProposal, target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateProposedSessionDiscovered(RtpSessionProposal sessionProposal, final DeviceDiscoveryState target) {
|
||||||
this.rtpSessionProposals.put(sessionProposal, target);
|
this.rtpSessionProposals.put(sessionProposal, target);
|
||||||
final RtpEndUserState endUserState = target.toEndUserState();
|
final RtpEndUserState endUserState = target.toEndUserState();
|
||||||
toneManager.transition(endUserState, sessionProposal.media);
|
toneManager.transition(endUserState, sessionProposal.media);
|
||||||
mXmppConnectionService.notifyJingleRtpConnectionUpdate(account, sessionProposal.with, sessionProposal.sessionId, endUserState);
|
mXmppConnectionService.notifyJingleRtpConnectionUpdate(sessionProposal.account, sessionProposal.with, sessionProposal.sessionId, endUserState);
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": flagging session " + sessionId + " as " + target);
|
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<RtpSessionProposal, DeviceDiscoveryState> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue