1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-23 20:42:06 +01:00

Fix errornous <activate> in s5b, calculate missing dst.addr

This commit is contained in:
vanitasvitae 2017-08-13 14:38:38 +02:00
parent 800bc49239
commit a9e80dc788
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 8 additions and 3 deletions

View file

@ -27,6 +27,7 @@ import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.bytestreams.socks5.Socks5Client; import org.jivesoftware.smackx.bytestreams.socks5.Socks5Client;
import org.jivesoftware.smackx.bytestreams.socks5.Socks5ClientForInitiator; import org.jivesoftware.smackx.bytestreams.socks5.Socks5ClientForInitiator;
import org.jivesoftware.smackx.bytestreams.socks5.Socks5Utils;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.jingle.component.JingleContent; import org.jivesoftware.smackx.jingle.component.JingleContent;
import org.jivesoftware.smackx.jingle.component.JingleSession; import org.jivesoftware.smackx.jingle.component.JingleSession;
@ -98,9 +99,13 @@ public class JingleS5BTransportCandidate extends JingleTransportCandidate<Jingle
case proxy: case proxy:
Socks5Client client; Socks5Client client;
if (peersProposal) { if (peersProposal) {
LOGGER.log(Level.INFO, "Connect to foreign candidate " + getCandidateId() + " using " + transport.getTheirDstAddr()); String dstAddr = transport.getTheirDstAddr();
if (dstAddr == null) {
dstAddr = Socks5Utils.createDigest(transport.getStreamId(), transport.getParent().getParent().getPeer(), transport.getParent().getParent().getOurJid());
}
LOGGER.log(Level.INFO, "Connect to foreign candidate " + getCandidateId() + " using " + dstAddr);
LOGGER.log(Level.INFO, getStreamHost().getAddress() + ":" + getStreamHost().getPort() + " " + getStreamHost().getJID().toString() + " " + getType()); LOGGER.log(Level.INFO, getStreamHost().getAddress() + ":" + getStreamHost().getPort() + " " + getStreamHost().getJID().toString() + " " + getType());
client = new Socks5Client(getStreamHost(), transport.getTheirDstAddr()); client = new Socks5Client(getStreamHost(), dstAddr);
} else { } else {
LOGGER.log(Level.INFO, "Connect to our candidate " + getCandidateId() + " using " + transport.getOurDstAddr()); LOGGER.log(Level.INFO, "Connect to our candidate " + getCandidateId() + " using " + transport.getOurDstAddr());
LOGGER.log(Level.INFO, getStreamHost().getAddress() + ":" + getStreamHost().getPort() + " " + getStreamHost().getJID().toString() + " " + getType()); LOGGER.log(Level.INFO, getStreamHost().getAddress() + ":" + getStreamHost().getPort() + " " + getStreamHost().getJID().toString() + " " + getType());

View file

@ -63,7 +63,7 @@ public abstract class JingleS5BTransportInfoElement extends JingleContentTranspo
} }
public static final class CandidateActivated extends JingleS5BCandidateTransportInfoElement { public static final class CandidateActivated extends JingleS5BCandidateTransportInfoElement {
public static final String ELEMENT = "candidate-activated"; public static final String ELEMENT = "activated";
public CandidateActivated(String candidateId) { public CandidateActivated(String candidateId) {
super(candidateId); super(candidateId);