From 6945ad3ef16e0dd11d7bbec9de19cae4844fe96d Mon Sep 17 00:00:00 2001 From: Victor Orlikowski Date: Fri, 25 Dec 2015 05:46:52 +0000 Subject: [PATCH] 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 Signed-off-by: FUJITA Tomonori --- ryu/controller/ofp_handler.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ryu/controller/ofp_handler.py b/ryu/controller/ofp_handler.py index a7068cf2..b3c63dfd 100644 --- a/ryu/controller/ofp_handler.py +++ b/ryu/controller/ofp_handler.py @@ -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