diff --git a/src/org/ice4j/ice/Agent.java b/src/org/ice4j/ice/Agent.java
index 5475551..8a4d29a 100644
--- a/src/org/ice4j/ice/Agent.java
+++ b/src/org/ice4j/ice/Agent.java
@@ -1012,6 +1012,11 @@ public class Agent
// received. The agent now sets the nominated flag in the
// valid pair to true.
nominationConfirmed( triggerPair );
+
+ //the above maye have caused us to exit, and so we need to
+ //make the call below in order to make sure that we update
+ //ICE processing state.
+ checkListStatesUpdated();
}
return;
@@ -1168,7 +1173,6 @@ public class Agent
atLeastOneListSucceeded = true;
}
}
-
//Once the state of each check list is Completed:
//The agent sets the state of ICE processing overall to Completed.
if(allListsEnded)
diff --git a/src/org/ice4j/ice/ConnectivityCheckServer.java b/src/org/ice4j/ice/ConnectivityCheckServer.java
index 0b4ea0b..6a42834 100644
--- a/src/org/ice4j/ice/ConnectivityCheckServer.java
+++ b/src/org/ice4j/ice/ConnectivityCheckServer.java
@@ -98,7 +98,7 @@ class ConnectivityCheckServer
|| ( ! parentAgent.isControlling()
&& request.contains(Attribute.ICE_CONTROLLED)))
{
- repairRoleConflict(evt);
+ if (!repairRoleConflict(evt))
return;
}
@@ -165,17 +165,25 @@ class ConnectivityCheckServer
/**
* Resolves a role conflicts by either sendinf a 487 Role Conflict
- * response or by changing this server's parent agent role.
+ * response or by changing this server's parent agent role. The method
+ * returns true if the role conflict is silently resolved and
+ * processing can continue. It returns false if we had to reply
+ * with a 487 and processing needs to stop until a repaired request is
+ * received.
*
* @param evt the {@link StunMessageEvent} containing the
* ICE-CONTROLLING or ICE-CONTROLLED attribute that
* allowed us to detect the role conflict.
+ *
+ * @return true if the role conflict is silently resolved and
+ * processing can continue and false otherwise.
*/
- private void repairRoleConflict(StunMessageEvent evt)
+ private boolean repairRoleConflict(StunMessageEvent evt)
{
Message req = evt.getMessage();
long ourTieBreaker = parentAgent.getTieBreaker();
+
// If the agent is in the controlling role, and the
// ICE-CONTROLLING attribute is present in the request:
if(parentAgent.isControlling()
@@ -201,6 +209,8 @@ class ConnectivityCheckServer
evt.getTransactionID().getBytes(),
response, evt.getLocalAddress(),
evt.getRemoteAddress());
+
+ return false;
}
catch(Exception exc)
{
@@ -218,6 +228,7 @@ class ConnectivityCheckServer
+ theirTieBreaker + " and ourTieBreaker="
+ ourTieBreaker);
parentAgent.setControlling(false);
+ return true;
}
}
// If the agent is in the controlled role, and the ICE-CONTROLLED
@@ -240,6 +251,7 @@ class ConnectivityCheckServer
+ theirTieBreaker + " and ourTieBreaker="
+ ourTieBreaker);
parentAgent.setControlling(true);
+ return true;
}
// If the agent's tie-breaker is less than the contents of the
// ICE-CONTROLLED attribute, the agent generates a Binding error
@@ -256,6 +268,8 @@ class ConnectivityCheckServer
evt.getTransactionID().getBytes(),
response, evt.getLocalAddress(),
evt.getRemoteAddress());
+
+ return false;
}
catch(Exception exc)
{
@@ -264,6 +278,7 @@ class ConnectivityCheckServer
}
}
}
+ return true; // we don't have a role conflict
}
/**