Skip to content

Commit

Permalink
Adds ssltcp support.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev committed Sep 4, 2014
1 parent fdbe2b3 commit b0bb20b
Showing 1 changed file with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions src/org/jitsi/videobridge/IceUdpTransportManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ public class IceUdpTransportManager
private static final String TCP_HARVESTER_PORT
= "org.jitsi.videobridge.TCP_HARVESTER_PORT";

/**
* The name of the property which controls the use of ssltcp candidates by
* <tt>MultiplexingTcpHostHarvester</tt>.
*/
private static final String TCP_HARVESTER_SSLTCP
= "org.jitsi.videobridge.TCP_HARVESTER_SSLTCP";

/**
* The default value of the <tt>TCP_HARVESTER_SSLTCP</tt> property.
*/
private static final boolean TCP_HARVESTER_SSLTCP_DEFAULT = true;

/**
* The single <tt>MultiplexingTcpHostHarvester</tt> instance for the
* application.
Expand Down Expand Up @@ -795,7 +807,17 @@ private void describe(
candidatePE.setID(generateCandidateID(candidate));
candidatePE.setNetwork(0);
candidatePE.setPriority(candidate.getPriority());
candidatePE.setProtocol(candidate.getTransport().toString());

// Advertise 'tcp' candidates for which SSL is enabled as 'ssltcp'
// (although internally their transport protocol remains "tcp")
Transport transport = candidate.getTransport();
if (transport == Transport.TCP
&& candidate.isSSL())
{
transport = Transport.SSLTCP;
}
candidatePE.setProtocol(transport.toString());

candidatePE.setType(
CandidateType.valueOf(candidate.getType().toString()));

Expand Down Expand Up @@ -1542,6 +1564,9 @@ private void initializeTcpHarvester()
boolean fallback = false;
if (!cfg.getBoolean(DISABLE_TCP_HARVESTER, false))
{
boolean ssltcp = cfg.getBoolean(TCP_HARVESTER_SSLTCP,
TCP_HARVESTER_SSLTCP_DEFAULT);

int port = cfg.getInt(TCP_HARVESTER_PORT, -1);
if (port == -1)
{
Expand All @@ -1551,7 +1576,8 @@ private void initializeTcpHarvester()

try
{
tcpHostHarvester = new MultiplexingTcpHostHarvester(port);
tcpHostHarvester
= new MultiplexingTcpHostHarvester(port, ssltcp);
}
catch (IOException ioe)
{
Expand All @@ -1565,20 +1591,28 @@ private void initializeTcpHarvester()

if (fallback)
{
port = TCP_FALLBACK_PORT;
try
{
tcpHostHarvester
= new MultiplexingTcpHostHarvester(
TCP_FALLBACK_PORT);
port,
ssltcp);

}
catch (IOException e)
{
logger.warn("Failed to initialize TCP harvester on "
+ "fallback port " + TCP_FALLBACK_PORT
+ ": " + e);
+ "fallback port " + port + ": " + e);
return;
}
}

if (logger.isInfoEnabled())
{
logger.info("Initialized TCP harvester on port " + port
+ ", using SSLTCP:" + ssltcp);
}
}
}
}
Expand Down

0 comments on commit b0bb20b

Please sign in to comment.