From 62fa72cf8a88c25e8cac4a94461a52ef7b1cc3c8 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 27 Oct 2021 11:46:02 +0200
Subject: [PATCH] L2SS-460: Do NOT use send_hello during a live connection!

---
 devices/clients/opcua_client.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/devices/clients/opcua_client.py b/devices/clients/opcua_client.py
index bf68edd19..1c6ee3562 100644
--- a/devices/clients/opcua_client.py
+++ b/devices/clients/opcua_client.py
@@ -86,7 +86,9 @@ class OPCUAConnection(AsyncCommClient):
         ping the client to make sure the connection with the client is still functional.
         """
         try:
-            await self.client.send_hello()
+            # do a cheap call. NOTE: send_hello is not allowed after establishing a connection,
+            # so cannot be used here. see https://reference.opcfoundation.org/v104/Core/docs/Part6/7.1.3/
+            _ = await self.client.get_namespace_array()
         except Exception as e:
             raise IOError("Lost connection to server %s: %s", self._servername(), e)
 
-- 
GitLab