Skip to content
Snippets Groups Projects
Commit 0cf7a857 authored by Alexandre MALFREYT's avatar Alexandre MALFREYT Committed by Florent LANGLOIS
Browse files

Revert ee15f79a as it doesn't really fix socket closure in delete_device. Add a...

Revert ee15f79a as it doesn't really fix socket closure in delete_device. Add a simple sleep period instead.
parent abbcc447
No related branches found
No related tags found
1 merge request!2Python 3 + améliorations
......@@ -42,7 +42,6 @@ __all__ = ["GEpressCtrlPACE5000", "GEpressCtrlPACE5000Class", "main"]
__docformat__ = 'restructuredtext'
import time
import PyTango
import sys
# Add additional import
......@@ -91,22 +90,8 @@ class GEpressCtrlPACE5000 (PyTango.LatestDeviceImpl):
except Exception as e:
self.error_stream("Error closing socket: " + str(e))
# Check if the socket is closed (doesn't usually close immediately)
max_tries = 5
sleep_time = 0.2
closed = False
for _ in range(max_tries):
if not hasattr(self, 'socket') or self.socket is None:
closed = True
break
time.sleep(sleep_time)
if not closed:
self.error_stream("Socket connection could not be closed after " + str(max_tries) + " tries")
self.set_state(PyTango.DevState.FAULT)
self.set_status("Socket connection could not be closed")
else:
self.info_stream("Socket connection closed successfully")
# let time for the socket to close completly (doesn't usually close immediately)
time.sleep(0.5)
#----- PROTECTED REGION END -----# // GEpressCtrlPACE5000.delete_device
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment