From b6f3e0c0bbf81d2023b602f1f5a28013fd5027bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Romain=20BRON=C3=88S?= <romain.brones@synchrotron-soleil.fr>
Date: Tue, 6 Aug 2024 13:30:23 +0200
Subject: [PATCH] fix: CCN start/stop pack/unpack reverted for centralnode

* Stop the source of the data flow before stopping the sink
---
 FofbTool/Operation.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/FofbTool/Operation.py b/FofbTool/Operation.py
index c33f7bb..d5a3f39 100644
--- a/FofbTool/Operation.py
+++ b/FofbTool/Operation.py
@@ -127,8 +127,12 @@ def stop_ccn(node_tangopath, ccnif=[]):
 
     logger.info("Stopping CCN on {}".format(node_tangopath))
     for n in ccnif:
-        prx["ccnpack{}_control".format(n)] = False
-        prx["ccnunpack{}_control".format(n)] = False
+        if 'central' in node_tangopath:
+            prx["ccnunpack{}_control".format(n)] = False
+            prx["ccnpack{}_control".format(n)] = False
+        else:
+            prx["ccnpack{}_control".format(n)] = False
+            prx["ccnunpack{}_control".format(n)] = False
 
 def reset_ccn(node_tangopath, ccnif=[]):
     """
@@ -195,8 +199,12 @@ def start_ccn(node_tangopath, ccnif=[]):
     ack_ccn(node_tangopath, ccnif)
 
     for n in ccnif:
-        prx["ccnpack{}_control".format(n)] = 1
-        prx["ccnunpack{}_control".format(n)] = 1
+        if 'central' in node_tangopath:
+            prx["ccnunpack{}_control".format(n)] = 1
+            prx["ccnpack{}_control".format(n)] = 1
+        else:
+            prx["ccnpack{}_control".format(n)] = 1
+            prx["ccnunpack{}_control".format(n)] = 1
 
 def ack_ccn(node_tangopath, ccnif=[]):
     """
-- 
GitLab