daemon: removed unused variable in sdt code and update to avoid deadlock when deleting nodes due to sdt trying to leverage the same lock on reconnect

This commit is contained in:
Blake Harnden 2020-12-16 21:32:47 -08:00
parent 4ec9ea7b16
commit 2e77907d72
2 changed files with 4 additions and 3 deletions

View file

@ -1129,13 +1129,16 @@ class Session:
"""
Clear the nodes dictionary, and call shutdown for each node.
"""
nodes_ids = []
with self.nodes_lock:
funcs = []
while self.nodes:
_, node = self.nodes.popitem()
self.sdt.delete_node(node.id)
nodes_ids.append(node.id)
funcs.append((node.shutdown, [], {}))
utils.threadpool(funcs)
for node_id in nodes_ids:
self.sdt.delete_node(node_id)
def write_nodes(self) -> None:
"""

View file

@ -4,7 +4,6 @@ sdt.py: Scripted Display Tool (SDT3D) helper
import logging
import socket
import threading
from typing import IO, TYPE_CHECKING, Dict, Optional, Set, Tuple
from urllib.parse import urlparse
@ -65,7 +64,6 @@ class Sdt:
:param session: session this manager is tied to
"""
self.session: "Session" = session
self.lock: threading.Lock = threading.Lock()
self.sock: Optional[IO] = None
self.connected: bool = False
self.url: str = self.DEFAULT_SDT_URL