Enables relay through a TURN server using ChannelData messages. The implementation is not supposed to be active in run-sample because run-sample only sends connectivity checks through the relay and ICE recommends using ChannelData only after ICE has completed. The relay automatically switches from Send/Data indications to ChannelData messages when the first non-STUN message is sent through it.
This commit is contained in:
parent
dea667e8b5
commit
3d4de0f547
@ -237,11 +237,8 @@ public class RelayedCandidateDatagramSocket
|
|||||||
*/
|
*/
|
||||||
private boolean channelDataSocketAccept(DatagramPacket p)
|
private boolean channelDataSocketAccept(DatagramPacket p)
|
||||||
{
|
{
|
||||||
/*
|
// Is it from our TURN server?
|
||||||
* Is it from our TURN server and, more specifically, via the Allocation
|
if (turnCandidateHarvest.harvester.stunServer.equals(p.getSocketAddress()))
|
||||||
* we have created on it?
|
|
||||||
*/
|
|
||||||
if (getLocalSocketAddress().equals(p.getSocketAddress()))
|
|
||||||
{
|
{
|
||||||
int pLength = p.getLength();
|
int pLength = p.getLength();
|
||||||
|
|
||||||
@ -283,14 +280,7 @@ public class RelayedCandidateDatagramSocket
|
|||||||
* the padding that is sometimes present in the data of the
|
* the padding that is sometimes present in the data of the
|
||||||
* DatagramPacket.
|
* DatagramPacket.
|
||||||
*/
|
*/
|
||||||
boolean accept
|
return ((CHANNELDATA_LENGTH_LENGTH + length) >= pLength);
|
||||||
= ((CHANNELDATA_LENGTH_LENGTH + length) >= pLength);
|
|
||||||
|
|
||||||
System.err.println(
|
|
||||||
getClass().getSimpleName()
|
|
||||||
+ ".channelDataSocketAccept: "
|
|
||||||
+ accept);
|
|
||||||
return accept;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -916,14 +906,14 @@ System.err.println(
|
|||||||
*/
|
*/
|
||||||
boolean forceBind = false;
|
boolean forceBind = false;
|
||||||
|
|
||||||
// if ((channelDataSocket != null)
|
if ((channelDataSocket != null)
|
||||||
// && !channel.getChannelDataIsPreferred()
|
&& !channel.getChannelDataIsPreferred()
|
||||||
// && !connectivityCheckRecognizer.accept(
|
&& !connectivityCheckRecognizer.accept(
|
||||||
// packetToSend))
|
packetToSend))
|
||||||
// {
|
{
|
||||||
// channel.setChannelDataIsPreferred(true);
|
channel.setChannelDataIsPreferred(true);
|
||||||
// forceBind = true;
|
forceBind = true;
|
||||||
// }
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Either bind the channel or send the packetToSend through
|
* Either bind the channel or send the packetToSend through
|
||||||
@ -1411,11 +1401,11 @@ System.err.println(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Channel Number
|
// Channel Number
|
||||||
data[0] = (byte) (channelNumber >> 8);
|
channelData[0] = (byte) (channelNumber >> 8);
|
||||||
data[1] = (byte) (channelNumber & 0xFF);
|
channelData[1] = (byte) (channelNumber & 0xFF);
|
||||||
// Length
|
// Length
|
||||||
data[2] = (byte) (length >> 8);
|
channelData[2] = (byte) (length >> 8);
|
||||||
data[3] = (byte) (length & 0xFF);
|
channelData[3] = (byte) (length & 0xFF);
|
||||||
// Application Data
|
// Application Data
|
||||||
System.arraycopy(
|
System.arraycopy(
|
||||||
data,
|
data,
|
||||||
@ -1431,10 +1421,11 @@ System.err.println(
|
|||||||
{
|
{
|
||||||
channelDataPacket
|
channelDataPacket
|
||||||
= new DatagramPacket(
|
= new DatagramPacket(
|
||||||
channelData, 0, channelData.length,
|
channelData, 0, channelDataLength,
|
||||||
getLocalSocketAddress());
|
turnCandidateHarvest.harvester.stunServer);
|
||||||
}
|
}
|
||||||
channelDataPacket.setLength(channelDataLength);
|
else
|
||||||
|
channelDataPacket.setData(channelData, 0, channelDataLength);
|
||||||
|
|
||||||
channelDataSocket.send(channelDataPacket);
|
channelDataSocket.send(channelDataPacket);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user