From 4136af4048e3d05f3432614b2421fbcebb97ed33 Mon Sep 17 00:00:00 2001 From: Jason Ye Date: Thu, 25 Apr 2013 14:50:23 -0700 Subject: [PATCH] In the case when sync msg failed, the returned error msg is listened by both sync msg worker thread and FlowProgrammerService. For sync msg error, FlowProgrammerService should skip the error since it'll be handled by sync msg worker thread. Signed-off-by: Jason Ye --- .../internal/FlowProgrammerService.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java index 4d3dca1878..d473a462c4 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java @@ -445,7 +445,20 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, xid = errorMsg.getXid(); } - long rid = getMessageRid(sw.getId(), xid); + Long rid = getMessageRid(sw.getId(), xid); + /* + * Null or zero requestId indicates that the error message is meant for + * a sync message. It will be handled by the sync message worker thread. + * Hence we are done here. + */ + if ((rid == null) || (rid == 0)) { + return; + } + + /* + * Notifies the caller that error has been reported for a previous flow + * programming request + */ for (Map.Entry containerNotifier : flowProgrammerNotifiers .entrySet()) { IFlowProgrammerNotifier notifier = containerNotifier.getValue(); @@ -585,10 +598,14 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, * The OF message xid * @return The Request ID */ - public long getMessageRid(long swid, int xid) { + private Long getMessageRid(long swid, Integer xid) { + Long rid = null; + + if (xid == null) { + return rid; + } + Map swxid2rid = this.xid2rid.get(swid); - long rid = 0; - if (swxid2rid != null) { rid = swxid2rid.get(xid); } -- 2.36.6