Implements client side role conflict detection and resolution (RFC 5245: Section 7.1.3.1)
This commit is contained in:
parent
91b3474a79
commit
bc285371e0
@ -67,7 +67,7 @@ public class CheckList
|
|||||||
*
|
*
|
||||||
* @param pair the pair to schedule a triggered check for.
|
* @param pair the pair to schedule a triggered check for.
|
||||||
*/
|
*/
|
||||||
protected void scheduleTriggeredCheck(CandidatePair pair)
|
public void scheduleTriggeredCheck(CandidatePair pair)
|
||||||
{
|
{
|
||||||
synchronized(triggeredCheckQueue)
|
synchronized(triggeredCheckQueue)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -167,7 +167,10 @@ public class ConnectivityCheckClient
|
|||||||
== Response.BINDING_ERROR_RESPONSE)
|
== Response.BINDING_ERROR_RESPONSE)
|
||||||
{
|
{
|
||||||
if(! response.getResponse().contains(Attribute.ERROR_CODE))
|
if(! response.getResponse().contains(Attribute.ERROR_CODE))
|
||||||
|
{
|
||||||
|
logger.fine("Received a malformed error response.");
|
||||||
return; //malformed error response
|
return; //malformed error response
|
||||||
|
}
|
||||||
|
|
||||||
processErrorResponse(response);
|
processErrorResponse(response);
|
||||||
}
|
}
|
||||||
@ -178,16 +181,25 @@ public class ConnectivityCheckClient
|
|||||||
Response response = evt.getResponse();
|
Response response = evt.getResponse();
|
||||||
Request originalRequest = evt.getRequest();
|
Request originalRequest = evt.getRequest();
|
||||||
|
|
||||||
Attribute errorCode = response.getAttribute(Attribute.ERROR_CODE);
|
ErrorCodeAttribute errorCode = (ErrorCodeAttribute)response
|
||||||
|
.getAttribute(Attribute.ERROR_CODE);
|
||||||
|
|
||||||
|
logger.finest("Received error code " + errorCode.getErrorCode());
|
||||||
|
|
||||||
//RESOLVE ROLE_CONFLICTS
|
//RESOLVE ROLE_CONFLICTS
|
||||||
if(response.contains(ErrorCodeAttribute.ROLE_CONFLICT))
|
if(errorCode.getErrorCode() == ErrorCodeAttribute.ROLE_CONFLICT)
|
||||||
{
|
{
|
||||||
boolean wasControlling = originalRequest
|
boolean wasControlling = originalRequest
|
||||||
.contains(Attribute.ICE_CONTROLLING);
|
.contains(Attribute.ICE_CONTROLLING);
|
||||||
|
|
||||||
logger.finest("Swithing to isControlling=" + !wasControlling);
|
System.out.println("Swithing to isControlling=" + !wasControlling);
|
||||||
parentAgent.setControlling(!wasControlling);
|
parentAgent.setControlling(!wasControlling);
|
||||||
|
|
||||||
|
CandidatePair pair = ((CandidatePair)evt.getTransactionID()
|
||||||
|
.getApplicationData());
|
||||||
|
|
||||||
|
pair.getParentComponent().getParentStream().getCheckList()
|
||||||
|
.scheduleTriggeredCheck(pair);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -125,8 +125,9 @@ public class ConnectivityCheckServer
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated catch block
|
//try to trigger a 500 response although if this one failed,
|
||||||
e.printStackTrace();
|
//then chances are the 500 will fail too.
|
||||||
|
throw new RuntimeException("Failed to send a response", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user