Fix handling of state transition to config mode

We have found, in production usage, a race condition in the transition to config mode.

If a sufficient number of events is being received, the reply to the FeaturesRequest may be received before the datapath is able to move into CONFIG_DISPATCHER state. As a result, the EventOFPSwitchFeatures handler may never fire (because the reply is received before the datapath has changed state).

This patch also includes a minor typo fix.

Signed-off-by: Victor J. Orlikowski <vjo@duke.edu>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Victor Orlikowski 2015-12-25 05:46:52 +00:00 committed by FUJITA Tomonori
parent 46f4ced165
commit 6945ad3ef1

View File

@ -181,14 +181,14 @@ class OFPHandler(ryu.base.app_manager.RyuApp):
return
datapath.set_version(max(usable_versions))
# now send feature
features_reqeust = datapath.ofproto_parser.OFPFeaturesRequest(datapath)
datapath.send_msg(features_reqeust)
# now move on to config state
# Move on to config state
self.logger.debug('move onto config mode')
datapath.set_state(CONFIG_DISPATCHER)
# Finally, send feature request
features_request = datapath.ofproto_parser.OFPFeaturesRequest(datapath)
datapath.send_msg(features_request)
@set_ev_handler(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self, ev):
msg = ev.msg