File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1027,14 +1027,7 @@ class gui_updater( threading.Thread ) :
10271027 # Teardown old connection handler properly
10281028 old_handler = self.__parent_class._interface__ups_handler
10291029 if old_handler is not None:
1030- try:
1031- # Close the underlying telnet connection if it exists
1032- if hasattr(old_handler, '_PyNUTClient__tn') and old_handler._PyNUTClient__tn is not None:
1033- old_handler._PyNUTClient__tn.close()
1034- elif hasattr(old_handler, 'tn') and old_handler.tn is not None:
1035- old_handler.tn.close()
1036- except Exception:
1037- pass # Best effort cleanup
1030+ old_handler.disconnect()
10381031 del old_handler
10391032
10401033 # Create a new connection handler
Original file line number Diff line number Diff line change @@ -1087,14 +1087,7 @@ class gui_updater :
10871087 # Teardown old connection handler properly
10881088 old_handler = self.__parent_class._interface__ups_handler
10891089 if old_handler is not None:
1090- try:
1091- # Close the underlying telnet connection if it exists
1092- if hasattr(old_handler, '_PyNUTClient__tn') and old_handler._PyNUTClient__tn is not None:
1093- old_handler._PyNUTClient__tn.close()
1094- elif hasattr(old_handler, 'tn') and old_handler.tn is not None:
1095- old_handler.tn.close()
1096- except Exception:
1097- pass # Best effort cleanup
1090+ old_handler.disconnect()
10981091 del old_handler
10991092
11001093 # Create a new connection handler
Original file line number Diff line number Diff line change @@ -1112,14 +1112,7 @@ class gui_updater :
11121112 # Teardown old connection handler properly
11131113 old_handler = self.__parent_class._interface__ups_handler
11141114 if old_handler is not None:
1115- try:
1116- # Close the underlying telnet connection if it exists
1117- if hasattr(old_handler, '_PyNUTClient__tn') and old_handler._PyNUTClient__tn is not None:
1118- old_handler._PyNUTClient__tn.close()
1119- elif hasattr(old_handler, 'tn') and old_handler.tn is not None:
1120- old_handler.tn.close()
1121- except Exception:
1122- pass # Best effort cleanup
1115+ old_handler.disconnect()
11231116 del old_handler
11241117
11251118 # Create a new connection handler
You can’t perform that action at this time.
0 commit comments