Fixes problems with server reflexives address checks (as all local candidates has their own ufrag we will not remove server reflexive candidates when pruning checklists. Handles STALE_CREDENTIALS error due to checks being sent too quickly to a remote peer that does not process candidates IQ yet.
This commit is contained in:
parent
16617e7234
commit
c91bfae9b0
@ -210,14 +210,15 @@ public class ErrorCodeAttribute extends Attribute
|
|||||||
/**
|
/**
|
||||||
* Sets this error's error class.
|
* Sets this error's error class.
|
||||||
* @param errorClass this error's error class.
|
* @param errorClass this error's error class.
|
||||||
* @throws IllegalArgumentException if errorClass is not a valid error class.
|
* @throws IllegalArgumentException if errorClass is not a valid error
|
||||||
|
* class.
|
||||||
*/
|
*/
|
||||||
public void setErrorClass(byte errorClass)
|
public void setErrorClass(byte errorClass)
|
||||||
throws IllegalArgumentException
|
throws IllegalArgumentException
|
||||||
{
|
{
|
||||||
if(errorClass < 0 || errorClass > 99)
|
if(errorClass < 0 || errorClass > 99)
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
errorClass + " is not a valid error number!");
|
errorClass + " is not a valid error number!");
|
||||||
this.errorClass = errorClass;
|
this.errorClass = errorClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1193,7 +1193,8 @@ public class Agent
|
|||||||
CandidatePair pair = findCandidatePair(localUFrag, remoteUFrag);
|
CandidatePair pair = findCandidatePair(localUFrag, remoteUFrag);
|
||||||
if(pair == null)
|
if(pair == null)
|
||||||
{
|
{
|
||||||
logger.info("No GTalk CandidatePair that match Lufrag/Rufrag");
|
logger.info("No GTalk CandidatePair that match Lufrag/Rufrag" +
|
||||||
|
" " + localUFrag + " " + remoteUFrag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -603,9 +603,14 @@ class ConnectivityCheckClient
|
|||||||
Response response = evt.getResponse();
|
Response response = evt.getResponse();
|
||||||
Request originalRequest = evt.getRequest();
|
Request originalRequest = evt.getRequest();
|
||||||
|
|
||||||
char errorCode
|
ErrorCodeAttribute errorAttr = (ErrorCodeAttribute)response.
|
||||||
= ((ErrorCodeAttribute) response.getAttribute(Attribute.ERROR_CODE))
|
getAttribute(Attribute.ERROR_CODE);
|
||||||
.getErrorCode();
|
// GTalk error code is not RFC3489/RFC5389 compliant
|
||||||
|
// example: 400 becomes 0x01 0x90 with GTalk
|
||||||
|
// RFC3489/RFC5389 gives 0x04 0x00
|
||||||
|
int cl = errorAttr.getErrorClass();
|
||||||
|
int co = errorAttr.getErrorNumber() & 0xff;
|
||||||
|
char errorCode = errorAttr.getErrorCode();
|
||||||
|
|
||||||
CandidatePair pair = ((CandidatePair)evt.getTransactionID()
|
CandidatePair pair = ((CandidatePair)evt.getTransactionID()
|
||||||
.getApplicationData());
|
.getApplicationData());
|
||||||
@ -624,6 +629,19 @@ class ConnectivityCheckClient
|
|||||||
pair.getParentComponent().getParentStream().getCheckList()
|
pair.getParentComponent().getParentStream().getCheckList()
|
||||||
.scheduleTriggeredCheck(pair);
|
.scheduleTriggeredCheck(pair);
|
||||||
}
|
}
|
||||||
|
else if(parentAgent.getCompatibilityMode() == CompatibilityMode.GTALK &&
|
||||||
|
cl == 1 && co == 0xae) // STALE_CREDENTIALS (430)
|
||||||
|
{
|
||||||
|
// it may be an error due to remote peer that does not processed
|
||||||
|
// our candidates IQ and we start connectivity checks too quickly
|
||||||
|
//(that's why we get a STALE CREDENTIALS because remote peer doesn't
|
||||||
|
// know the candidate ufrag). So let's send another check for that
|
||||||
|
// pair
|
||||||
|
logger.info("stale credentials for GTalk check for " +
|
||||||
|
pair.toShortString());
|
||||||
|
startCheckForPair(pair);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logger.fine("Received an unrecoverable error response for pair "
|
logger.fine("Received an unrecoverable error response for pair "
|
||||||
|
|||||||
@ -410,19 +410,22 @@ public class IceMediaStream
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//replace local server reflexive candidates with their base.
|
if(parentAgent.getCompatibilityMode() == CompatibilityMode.RFC5245)
|
||||||
LocalCandidate localCnd = pair.getLocalCandidate();
|
|
||||||
if( localCnd.getType()
|
|
||||||
== CandidateType.SERVER_REFLEXIVE_CANDIDATE)
|
|
||||||
{
|
{
|
||||||
pair.setLocalCandidate(localCnd.getBase());
|
//replace local server reflexive candidates with their base.
|
||||||
|
LocalCandidate localCnd = pair.getLocalCandidate();
|
||||||
//if the new pair corresponds to another one with a higher
|
if( localCnd.getType()
|
||||||
//priority, then remove it.
|
== CandidateType.SERVER_REFLEXIVE_CANDIDATE)
|
||||||
if(tmpCheckList.contains(pair))
|
|
||||||
{
|
{
|
||||||
ckListIter.remove();
|
pair.setLocalCandidate(localCnd.getBase());
|
||||||
continue;
|
|
||||||
|
//if the new pair corresponds to another one with a higher
|
||||||
|
//priority, then remove it.
|
||||||
|
if(tmpCheckList.contains(pair))
|
||||||
|
{
|
||||||
|
ckListIter.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user