From eb353109694d8fcec54d3218bcec76bb8bc2eae6 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Mon, 20 Jul 2015 10:58:31 -0500 Subject: [PATCH] Compares tie breakers as unsigned longs to as RFC5245 mandates. Based on Matt Fredrickson's report and patch. Fixes #28. --- src/org/ice4j/ice/ConnectivityCheckServer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/ice4j/ice/ConnectivityCheckServer.java b/src/org/ice4j/ice/ConnectivityCheckServer.java index 23781f7..481837a 100644 --- a/src/org/ice4j/ice/ConnectivityCheckServer.java +++ b/src/org/ice4j/ice/ConnectivityCheckServer.java @@ -257,7 +257,7 @@ class ConnectivityCheckServer // contents of the ICE-CONTROLLING attribute, the agent generates // a Binding error response and includes an ERROR-CODE attribute // with a value of 487 (Role Conflict) but retains its role. - if( ourTieBreaker >= theirTieBreaker) + if(Long.compareUnsigned(ourTieBreaker, theirTieBreaker) >= 0) { Response response = MessageFactory.createBindingErrorResponse( ErrorCodeAttribute.ROLE_CONFLICT); @@ -304,7 +304,7 @@ class ConnectivityCheckServer //If the agent's tie-breaker is larger than or equal to the //contents of the ICE-CONTROLLED attribute, the agent switches to //the controlling role. - if(ourTieBreaker >= theirTieBreaker) + if(Long.compareUnsigned(ourTieBreaker, theirTieBreaker) >= 0) { logger.finer( "Switching to controlling because theirTieBreaker="