Fix candidate selection for equal priority

XEP-0260 states that the candidate selected (offered) by the initiator
wins, not the one that was chosen by the initiator (i.e. offered by the
responder).
This commit is contained in:
hrxi 2019-08-24 13:30:23 +02:00
parent 34d7b5f515
commit 6083f446b4
2 changed files with 4 additions and 3 deletions

View File

@ -720,7 +720,7 @@ public class Session {
.put_node(new StanzaNode.build("text", NS_URI)
.put_node(new StanzaNode.text(error.message))
);
terminate(reason, "transport error: $(error.message)");
terminate(reason, @"transport error: $(error.message)");
}
public void on_connection_close() {
if (terminate_on_connection_close) {

View File

@ -332,8 +332,9 @@ class Parameters : Jingle.TransportParameters, Object {
} else if (local.priority > remote.priority) {
remote_wins = false;
} else {
// equal priority -> XEP-0260 says that the initiator wins
remote_wins = role != Jingle.Role.INITIATOR;
// equal priority -> XEP-0260 says that the candidate offered
// by the initiator wins, so the one that the remote chose
remote_wins = role == Jingle.Role.INITIATOR;
}
}