In the case when sync msg failed, the returned error msg is listened by both sync... 56/256/1
authorJason Ye <yisye@cisco.com>
Thu, 25 Apr 2013 21:50:23 +0000 (14:50 -0700)
committerJason Ye <yisye@cisco.com>
Thu, 25 Apr 2013 21:50:23 +0000 (14:50 -0700)
Signed-off-by: Jason Ye <yisye@cisco.com>
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java

index 4d3dca187863d5943b69a06e8f2cf8c88e2aa11f..d473a462c410332781b906c743804bca54d3da8a 100644 (file)
@@ -445,7 +445,20 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService,
             xid = errorMsg.getXid();
         }
 
             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<String, IFlowProgrammerNotifier> containerNotifier : flowProgrammerNotifiers
                 .entrySet()) {
             IFlowProgrammerNotifier notifier = containerNotifier.getValue();
         for (Map.Entry<String, IFlowProgrammerNotifier> containerNotifier : flowProgrammerNotifiers
                 .entrySet()) {
             IFlowProgrammerNotifier notifier = containerNotifier.getValue();
@@ -585,10 +598,14 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService,
      *            The OF message xid
      * @return The Request ID
      */
      *            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<Integer, Long> swxid2rid = this.xid2rid.get(swid);
         Map<Integer, Long> swxid2rid = this.xid2rid.get(swid);
-        long rid = 0;
-        
         if (swxid2rid != null) {
             rid = swxid2rid.get(xid);
         }
         if (swxid2rid != null) {
             rid = swxid2rid.get(xid);
         }