use higher priority for proxy on receiving end

This commit is contained in:
Daniel Gultsch 2019-09-02 08:51:50 +02:00
parent 90e669313e
commit ff4d127b6f
2 changed files with 4 additions and 5 deletions

View file

@ -307,7 +307,7 @@ public class JingleConnection implements Transferable {
this.sendInitRequest(); this.sendInitRequest();
} else { } else {
gatherAndConnectDirectCandidates(); gatherAndConnectDirectCandidates();
this.mJingleConnectionManager.getPrimaryCandidate(account, (success, candidate) -> { this.mJingleConnectionManager.getPrimaryCandidate(account, initiating(), (success, candidate) -> {
if (success) { if (success) {
final JingleSocks5Transport socksConnection = new JingleSocks5Transport(this, candidate); final JingleSocks5Transport socksConnection = new JingleSocks5Transport(this, candidate);
connections.put(candidate.getCid(), socksConnection); connections.put(candidate.getCid(), socksConnection);
@ -585,7 +585,7 @@ public class JingleConnection implements Transferable {
private void sendAcceptSocks() { private void sendAcceptSocks() {
gatherAndConnectDirectCandidates(); gatherAndConnectDirectCandidates();
this.mJingleConnectionManager.getPrimaryCandidate(this.account, (success, candidate) -> { this.mJingleConnectionManager.getPrimaryCandidate(this.account, initiating(), (success, candidate) -> {
final JinglePacket packet = bootstrapPacket("session-accept"); final JinglePacket packet = bootstrapPacket("session-accept");
final Content content = new Content(contentCreator, contentName); final Content content = new Content(contentCreator, contentName);
content.setFileOffer(fileOffer, ftVersion); content.setFileOffer(fileOffer, ftVersion);

View file

@ -81,8 +81,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
this.connections.remove(connection); this.connections.remove(connection);
} }
public void getPrimaryCandidate(Account account, public void getPrimaryCandidate(final Account account, final boolean initiator, final OnPrimaryCandidateFound listener) {
final OnPrimaryCandidateFound listener) {
if (Config.DISABLE_PROXY_LOOKUP) { if (Config.DISABLE_PROXY_LOOKUP) {
listener.onPrimaryCandidateFound(false, null); listener.onPrimaryCandidateFound(false, null);
return; return;
@ -107,7 +106,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
candidate.setPort(Integer.parseInt(port)); candidate.setPort(Integer.parseInt(port));
candidate.setType(JingleCandidate.TYPE_PROXY); candidate.setType(JingleCandidate.TYPE_PROXY);
candidate.setJid(proxy); candidate.setJid(proxy);
candidate.setPriority(655360 + 65535); candidate.setPriority(655360 + (initiator ? 10 : 20));
primaryCandidates.put(account.getJid().asBareJid(),candidate); primaryCandidates.put(account.getJid().asBareJid(),candidate);
listener.onPrimaryCandidateFound(true,candidate); listener.onPrimaryCandidateFound(true,candidate);
} catch (final NumberFormatException e) { } catch (final NumberFormatException e) {