Take into account the transport protocol for mapped candidates. Preserve

the isSSL flag.
This commit is contained in:
boris 2014-09-09 14:46:01 +00:00
parent f08c6546ae
commit 89082b2c1a

View File

@ -79,22 +79,26 @@ public class MappingCandidateHarvester
{ {
if (!(cand instanceof HostCandidate) if (!(cand instanceof HostCandidate)
|| !cand.getTransportAddress().getHostAddress() || !cand.getTransportAddress().getHostAddress()
.equals(face.getHostAddress())) .equals(face.getHostAddress())
|| cand.getTransport() != face.getTransport())
{ {
continue; continue;
} }
HostCandidate hostCandidate = (HostCandidate) cand;
TransportAddress mappedAddress = new TransportAddress( TransportAddress mappedAddress = new TransportAddress(
mask.getHostAddress(), mask.getHostAddress(),
cand.getHostAddress().getPort(), hostCandidate.getHostAddress().getPort(),
cand.getHostAddress().getTransport()); hostCandidate.getHostAddress().getTransport());
ServerReflexiveCandidate mappedCandidate ServerReflexiveCandidate mappedCandidate
= new ServerReflexiveCandidate( = new ServerReflexiveCandidate(
mappedAddress, mappedAddress,
(HostCandidate)cand, hostCandidate,
cand.getStunServerAddress(), hostCandidate.getStunServerAddress(),
CandidateExtendedType.STATICALLY_MAPPED_CANDIDATE); CandidateExtendedType.STATICALLY_MAPPED_CANDIDATE);
if (hostCandidate.isSSL())
mappedCandidate.setSSL(true);
//try to add the candidate to the component and then //try to add the candidate to the component and then
//only add it to the harvest not redundant //only add it to the harvest not redundant