Skip to content
Snippets Groups Projects
Commit a610b151 authored by Gregor Maier's avatar Gregor Maier
Browse files

Queue PortStatus messages after featuresReply until we get a switch instance

parent 611077b7
No related branches found
No related tags found
No related merge requests found
......@@ -72,6 +72,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Channel handler deals with the switch connection and dispatches
* switch messages to the appropriate locations.
......@@ -96,6 +97,8 @@ class OFChannelHandler
private RoleChanger roleChanger;
private OFFeaturesReply featuresReply;
private ArrayList<OFPortStatus> pendingPortStatusMsg;
/** transaction Ids to use during handshake. Since only one thread
* calls into the OFChannelHandler we don't need atomic.
* We will count down
......@@ -541,6 +544,12 @@ class OFChannelHandler
void processOFError(OFChannelHandler h, OFError m) {
logErrorDisconnect(h, m);
}
@Override
void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
throws IOException {
h.pendingPortStatusMsg.add(m);
}
},
/**
......@@ -583,6 +592,9 @@ class OFChannelHandler
h.sw.setFloodlightProvider(h.controller);
h.sw.setThreadPoolService(h.controller.getThreadPoolService());
h.sw.setDebugCounterService(h.controller.getDebugCounter());
for (OFPortStatus ps: h.pendingPortStatusMsg)
handlePortStatusMessage(h, ps, false);
h.pendingPortStatusMsg.clear();
h.readPropertyFromStorage();
log.info("Switch {} bound to class {}, writeThrottle={}," +
" description {}",
......@@ -659,8 +671,7 @@ class OFChannelHandler
@Override
void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
throws IOException {
// TODO
handlePortStatusMessage(h, m);
handlePortStatusMessage(h, m, false);
}
},
......@@ -742,8 +753,7 @@ class OFChannelHandler
@Override
void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
throws IOException {
handlePortStatusMessage(h, m);
// FIXME: ---> h.dispatchMessage(m);
handlePortStatusMessage(h, m, true);
}
@Override
......@@ -979,7 +989,8 @@ class OFChannelHandler
* @param m The PortStatus message we received
*/
protected void handlePortStatusMessage(OFChannelHandler h,
OFPortStatus m) {
OFPortStatus m,
boolean doNotify) {
short portNumber = m.getDesc().getPortNumber();
OFPhysicalPort port = m.getDesc();
OFPortReason reason = OFPortReason.fromReasonCode(m.getReason());
......@@ -1016,7 +1027,8 @@ class OFChannelHandler
log.debug("Port #{} deleted for {}", portNumber, h.sw);
break;
}
h.controller.notifyPortChanged(h.sw, port, changeType);
if (doNotify)
h.controller.notifyPortChanged(h.sw, port, changeType);
}
/**
......@@ -1199,6 +1211,7 @@ class OFChannelHandler
this.counters = controller.getCounters();
this.roleChanger = new RoleChanger(DEFAULT_ROLE_TIMEOUT_MS);
this.state = ChannelState.INIT;
this.pendingPortStatusMsg = new ArrayList<OFPortStatus>();
}
/**
......
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