Skip to content
Snippets Groups Projects
Commit 06d0bfb2 authored by Srinivasan Ramasubramanian's avatar Srinivasan Ramasubramanian
Browse files

Rechedule discovery task only if role is MASTER. Also, start the scheduling...

Rechedule discovery task only if role is MASTER.  Also, start the scheduling when role is changed to master.
parent dea38f15
No related branches found
No related tags found
No related merge requests found
......@@ -1585,7 +1585,8 @@ IFloodlightModule, IInfoProvider, IHAListener {
} catch (Exception e) {
log.error("Exception in LLDP send timer.", e);
} finally {
if (!shuttingDown) {
if (!shuttingDown &&
floodlightProvider.getRole() == Role.MASTER) {
discoveryTask.reschedule(DISCOVERY_TASK_INTERVAL,
TimeUnit.SECONDS);
}
......@@ -1606,7 +1607,8 @@ IFloodlightModule, IInfoProvider, IHAListener {
}}, "Topology Updates");
updatesThread.start();
discoveryTask.reschedule(DISCOVERY_TASK_INTERVAL, TimeUnit.SECONDS);
if (floodlightProvider.getRole() == Role.MASTER)
discoveryTask.reschedule(1, TimeUnit.MICROSECONDS);
// Register for the OpenFlow messages we want to receive
floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
floodlightProvider.addOFMessageListener(OFType.PORT_STATUS, this);
......@@ -1712,19 +1714,17 @@ IFloodlightModule, IInfoProvider, IHAListener {
}
// IHARoleListener
@Override
public void roleChanged(Role oldRole, Role newRole) {
switch(newRole) {
case MASTER:
if (oldRole == Role.SLAVE) {
clearAllLinks();
if (log.isTraceEnabled()) {
log.trace("Sending LLDPs " +
"to HA change from SLAVE->MASTER");
}
clearAllLinks();
discoverLinks();
discoveryTask.reschedule(1, TimeUnit.MICROSECONDS);
}
break;
case SLAVE:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment