Fixes NPE. Catches an OutOfMemoryError related to a thread creation. Lower priority for IPv6 link-local candidate compared to IPv6 global ones.
This commit is contained in:
parent
2591b21992
commit
e7aafa2e1a
@ -1623,16 +1623,24 @@ public class Agent
|
||||
{
|
||||
for(Component c : stream.getComponents())
|
||||
{
|
||||
StringBuffer buf = new StringBuffer(
|
||||
"Harvester selected for ");
|
||||
buf.append(c.toShortString());
|
||||
buf.append(" ");
|
||||
if(c.getSelectedPair() == null)
|
||||
{
|
||||
buf.append("none ");
|
||||
buf.append("(it means that conncheck failed)");
|
||||
logger.info(buf.toString());
|
||||
continue;
|
||||
}
|
||||
|
||||
TransportAddress serverAddr = c.getSelectedPair().
|
||||
getLocalCandidate().getStunServerAddress();
|
||||
TransportAddress relayAddr =
|
||||
c.getSelectedPair().getLocalCandidate().
|
||||
getRelayServerAddress();
|
||||
|
||||
StringBuffer buf = new StringBuffer(
|
||||
"Harvester selected for ");
|
||||
buf.append(c.toShortString());
|
||||
buf.append(" ");
|
||||
buf.append(c.getSelectedPair().getLocalCandidate().
|
||||
getType());
|
||||
|
||||
|
||||
@ -404,7 +404,14 @@ public abstract class Candidate
|
||||
|
||||
// IPv6 has better priority than IPv4
|
||||
if(addr instanceof Inet6Address)
|
||||
priority += 50;
|
||||
{
|
||||
if(addr.isLinkLocalAddress())
|
||||
{
|
||||
priority += 40;
|
||||
}
|
||||
else
|
||||
priority += 50;
|
||||
}
|
||||
|
||||
return priority;
|
||||
}
|
||||
@ -485,7 +492,7 @@ public abstract class Candidate
|
||||
|
||||
InetAddress addr = getTransportAddress().getAddress();
|
||||
|
||||
//the following tries to reusse precedence from RFC 3484 but that's a
|
||||
//the following tries to reuse precedence from RFC 3484 but that's a
|
||||
//bit tricky since it is not meant to be used exactly the way that
|
||||
//Johnnie seems to think.
|
||||
|
||||
|
||||
@ -263,6 +263,9 @@ class ConnectivityCheckClient
|
||||
candidatePair.getParentComponent().getParentStream().
|
||||
getName());
|
||||
|
||||
if(localUserName == null)
|
||||
return null;
|
||||
|
||||
UsernameAttribute unameAttr =
|
||||
AttributeFactory.createUsernameAttribute(localUserName);
|
||||
|
||||
@ -866,7 +869,8 @@ class ConnectivityCheckClient
|
||||
pair.toShortString());
|
||||
|
||||
// try again after some delay
|
||||
startDelayedCheckForPair(pair, 50);
|
||||
//startDelayedCheckForPair(pair, 100);
|
||||
startCheckForPair(pair);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
@ -293,6 +293,11 @@ public class StunStack
|
||||
}
|
||||
this.mode = mode;
|
||||
netAccessManager = new NetAccessManager(this);
|
||||
|
||||
if(mode == CompatibilityMode.GTALK)
|
||||
{
|
||||
netAccessManager.setThreadPoolSize(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -665,8 +670,20 @@ public class StunStack
|
||||
sTran = new StunServerTransaction(this, serverTid,
|
||||
event.getLocalAddress(), event.getRemoteAddress());
|
||||
|
||||
// if there is an OOM error here, it will lead to
|
||||
// NetAccessManager.handleFatalError that will stop the
|
||||
// MessageProcessor thread and restart it that will lead again
|
||||
// to an OOM error and so on... So stop here right now
|
||||
try
|
||||
{
|
||||
sTran.start();
|
||||
}
|
||||
catch(OutOfMemoryError t)
|
||||
{
|
||||
logger.info("STUN transaction thread start failed:" + t);
|
||||
return;
|
||||
}
|
||||
serverTransactions.put(serverTid, sTran);
|
||||
sTran.start();
|
||||
}
|
||||
|
||||
//validate attributes that need validation.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user