From 6e10382d98d7d84f60660d424973f0369feec2b0 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Wed, 17 Sep 2025 08:21:23 +0200 Subject: [PATCH] io: add reconnect command sometimes reconnecting helps to heal a broken connection Change-Id: I368ecb549ca346d7db3484f6a8be0a3a9a86aff1 Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/37433 Tested-by: Jenkins Automated Tests Reviewed-by: Georg Brandl Reviewed-by: Markus Zolliker --- frappy/io.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frappy/io.py b/frappy/io.py index a79cb97c..61e444e6 100644 --- a/frappy/io.py +++ b/frappy/io.py @@ -218,11 +218,20 @@ class IOBase(Communicator): def communicate(self, command): return NotImplementedError + @Command + def reconnect(self): + """close and open connection + + sometimes a reconnect helps to heal a broken connection + """ + self.closeConnection() + self.read_is_connected() # this always tries to reconnect + class StringIO(IOBase): """line oriented communicator - self healing is assured by polling the parameter 'is_connected' + self-healing is assured by polling the parameter 'is_connected' """ end_of_line = Property('end_of_line character', datatype=ValueType(), default='\n', settable=True)