Restart from the tree no longer hangs for 30 s on disconnect
With a wiresheet open, disconnecting first unsubscribed its components and waited for the reply, which a restarting device never sends, so the editor froze until the request timed out. After restart, reboot, quit or hibernate the session is now closed without asking the device anything; a plain Disconnect still unsubscribes first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it.
|
|||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
|
|
||||||
VERSION = "0.0.0.168"
|
VERSION = "0.0.0.169"
|
||||||
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
|
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
|
||||||
DEFAULT_GRID_SIZE = 10
|
DEFAULT_GRID_SIZE = 10
|
||||||
DEFAULT_ADD_TIMESTAMP = True
|
DEFAULT_ADD_TIMESTAMP = True
|
||||||
|
|||||||
+4
-2
@@ -60,11 +60,13 @@ class DeviceSession:
|
|||||||
self.sox_client.update(children, CONFIG | RUNTIME)
|
self.sox_client.update(children, CONFIG | RUNTIME)
|
||||||
return root_comp
|
return root_comp
|
||||||
|
|
||||||
def disconnect(self):
|
def disconnect(self, unsubscribe=True):
|
||||||
|
"""Closes the session. unsubscribe=False skips telling the device first -- for a
|
||||||
|
device going down, which would leave the request to time out."""
|
||||||
if self.sox_client is None:
|
if self.sox_client is None:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
if self._current_subs:
|
if unsubscribe and self._current_subs:
|
||||||
comps = [self.sox_client.cache_get(cid)
|
comps = [self.sox_client.cache_get(cid)
|
||||||
for cid in self._current_subs]
|
for cid in self._current_subs]
|
||||||
comps = [c for c in comps if c is not None]
|
comps = [c for c in comps if c is not None]
|
||||||
|
|||||||
@@ -636,7 +636,7 @@ def _invoke_app_action(slot_name):
|
|||||||
app_state.set_status(f"Invoked '{slot_name}' on device")
|
app_state.set_status(f"Invoked '{slot_name}' on device")
|
||||||
elif goes_down:
|
elif goes_down:
|
||||||
host = app_state.device_host
|
host = app_state.device_host
|
||||||
do_device_disconnect()
|
do_device_disconnect(device_down=True)
|
||||||
app_state.set_status(f"Sent '{slot_name}' to {host} and disconnected")
|
app_state.set_status(f"Sent '{slot_name}' to {host} and disconnected")
|
||||||
else:
|
else:
|
||||||
app_state.set_status(f"Invoked '{slot_name}' on device")
|
app_state.set_status(f"Invoked '{slot_name}' on device")
|
||||||
@@ -2996,8 +2996,9 @@ def _load_live_schema(ds):
|
|||||||
f"Missing kit manifests: {', '.join(missing)}", warn=True)
|
f"Missing kit manifests: {', '.join(missing)}", warn=True)
|
||||||
|
|
||||||
|
|
||||||
def do_device_disconnect():
|
def do_device_disconnect(device_down=False):
|
||||||
"""Disconnects from the live device."""
|
"""Disconnects from the live device. device_down: it was just told to restart (or
|
||||||
|
stop), so nothing is asked of it on the way out -- it would not answer."""
|
||||||
global _cov_poll_id
|
global _cov_poll_id
|
||||||
|
|
||||||
if _cov_poll_id is not None:
|
if _cov_poll_id is not None:
|
||||||
@@ -3006,7 +3007,7 @@ def do_device_disconnect():
|
|||||||
|
|
||||||
ds = app_state.device_session
|
ds = app_state.device_session
|
||||||
if ds is not None:
|
if ds is not None:
|
||||||
ds.disconnect()
|
ds.disconnect(unsubscribe=not device_down)
|
||||||
|
|
||||||
app_state.device_session = None
|
app_state.device_session = None
|
||||||
app_state.live_mode = False
|
app_state.live_mode = False
|
||||||
|
|||||||
Reference in New Issue
Block a user