ssdp_server.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. """SSDP discovery responder for virtual printer.
  2. Responds to M-SEARCH requests from slicers and sends periodic NOTIFY
  3. announcements so the virtual printer appears as a discoverable Bambu printer.
  4. Also provides SSDP proxy functionality for proxy mode, where Bambuddy sits
  5. between two networks and re-broadcasts printer SSDP from LAN A to LAN B.
  6. """
  7. import asyncio
  8. import logging
  9. import re
  10. import socket
  11. import struct
  12. logger = logging.getLogger(__name__)
  13. # SSDP addresses - Bambu uses port 2021
  14. # Real Bambu printers broadcast to 255.255.255.255, not multicast to 239.255.255.250
  15. SSDP_MULTICAST_ADDR = "239.255.255.250"
  16. SSDP_BROADCAST_ADDR = "255.255.255.255"
  17. SSDP_PORT = 2021
  18. # Bambu service target
  19. BAMBU_SEARCH_TARGET = "urn:bambulab-com:device:3dprinter:1"
  20. class VirtualPrinterSSDPServer:
  21. """SSDP server that responds to discovery requests as a virtual Bambu printer."""
  22. def __init__(
  23. self,
  24. name: str = "Bambuddy",
  25. serial: str = "00M09A391800001", # X1C serial format for compatibility
  26. model: str = "BL-P001", # X1C model code for best compatibility
  27. advertise_ip: str = "",
  28. bind_ip: str = "",
  29. ):
  30. """Initialize the SSDP server.
  31. Args:
  32. name: Display name shown in slicer discovery
  33. serial: Unique serial number
  34. model: Model code
  35. advertise_ip: Override IP to advertise instead of auto-detecting
  36. bind_ip: IP address to bind the SSDP socket to
  37. """
  38. self.name = name
  39. self.serial = serial
  40. self.model = model
  41. self._bind_ip = bind_ip
  42. self._running = False
  43. self._socket: socket.socket | None = None
  44. self._local_ip: str | None = advertise_ip or bind_ip or None
  45. def _get_local_ip(self) -> str:
  46. """Get the local IP address to advertise."""
  47. if self._local_ip:
  48. return self._local_ip
  49. # Try to determine local IP by connecting to a public address
  50. try:
  51. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  52. s.connect(("8.8.8.8", 80))
  53. ip = s.getsockname()[0]
  54. s.close()
  55. self._local_ip = ip
  56. return ip
  57. except OSError:
  58. return "127.0.0.1"
  59. def _build_notify_message(self) -> bytes:
  60. """Build SSDP NOTIFY message for periodic announcements."""
  61. ip = self._get_local_ip()
  62. message = (
  63. "NOTIFY * HTTP/1.1\r\n"
  64. f"Host: {SSDP_MULTICAST_ADDR}:1990\r\n"
  65. "Server: UPnP/1.0\r\n"
  66. f"Location: {ip}\r\n"
  67. f"NT: {BAMBU_SEARCH_TARGET}\r\n"
  68. "NTS: ssdp:alive\r\n"
  69. f"USN: {self.serial}\r\n"
  70. "Cache-Control: max-age=1800\r\n"
  71. f"DevModel.bambu.com: {self.model}\r\n"
  72. f"DevName.bambu.com: {self.name}\r\n"
  73. "DevSignal.bambu.com: -44\r\n"
  74. "DevConnect.bambu.com: lan\r\n"
  75. "DevBind.bambu.com: free\r\n"
  76. "Devseclink.bambu.com: secure\r\n"
  77. "DevInf.bambu.com: eth0\r\n"
  78. "DevVersion.bambu.com: 01.07.00.00\r\n"
  79. "DevCap.bambu.com: 1\r\n"
  80. "\r\n"
  81. )
  82. return message.encode()
  83. def _build_response_message(self) -> bytes:
  84. """Build SSDP response message for M-SEARCH requests."""
  85. ip = self._get_local_ip()
  86. message = (
  87. "HTTP/1.1 200 OK\r\n"
  88. "Server: UPnP/1.0\r\n"
  89. f"Location: {ip}\r\n"
  90. f"ST: {BAMBU_SEARCH_TARGET}\r\n"
  91. f"USN: {self.serial}\r\n"
  92. "Cache-Control: max-age=1800\r\n"
  93. f"DevModel.bambu.com: {self.model}\r\n"
  94. f"DevName.bambu.com: {self.name}\r\n"
  95. "DevSignal.bambu.com: -44\r\n"
  96. "DevConnect.bambu.com: lan\r\n"
  97. "DevBind.bambu.com: free\r\n"
  98. "Devseclink.bambu.com: secure\r\n"
  99. "DevInf.bambu.com: eth0\r\n"
  100. "DevVersion.bambu.com: 01.07.00.00\r\n"
  101. "DevCap.bambu.com: 1\r\n"
  102. "\r\n"
  103. )
  104. return message.encode()
  105. async def start(self) -> None:
  106. """Start the SSDP server."""
  107. if self._running:
  108. return
  109. logger.info("Starting virtual printer SSDP server: %s (%s)", self.name, self.serial)
  110. self._running = True
  111. try:
  112. # Create UDP socket
  113. self._socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
  114. self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  115. # Try to set SO_REUSEPORT if available
  116. try:
  117. self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
  118. except (AttributeError, OSError):
  119. pass # SO_REUSEPORT not available on all platforms; non-critical
  120. # Set non-blocking mode
  121. self._socket.setblocking(False)
  122. # Bind to SSDP port on specific interface (or all interfaces)
  123. self._socket.bind((self._bind_ip or "", SSDP_PORT))
  124. # Join multicast group (on specific interface if bind_ip is set)
  125. if self._bind_ip:
  126. mreq = struct.pack(
  127. "4s4s",
  128. socket.inet_aton(SSDP_MULTICAST_ADDR),
  129. socket.inet_aton(self._bind_ip),
  130. )
  131. else:
  132. mreq = struct.pack("4sl", socket.inet_aton(SSDP_MULTICAST_ADDR), socket.INADDR_ANY)
  133. self._socket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
  134. # Enable broadcast
  135. self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
  136. # Set multicast TTL
  137. self._socket.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
  138. local_ip = self._get_local_ip()
  139. logger.info("SSDP server listening on port %s, advertising IP: %s", SSDP_PORT, local_ip)
  140. logger.info("Virtual printer: %s (%s) model=%s", self.name, self.serial, self.model)
  141. # Send initial NOTIFY
  142. await self._send_notify()
  143. logger.info("Sent initial SSDP NOTIFY announcement")
  144. # Run receive and announce loops
  145. last_notify = asyncio.get_event_loop().time()
  146. notify_interval = 30.0 # Send NOTIFY every 30 seconds
  147. while self._running:
  148. # Try to receive M-SEARCH requests
  149. try:
  150. data, addr = self._socket.recvfrom(4096)
  151. message = data.decode("utf-8", errors="ignore")
  152. await self._handle_message(message, addr)
  153. except BlockingIOError:
  154. pass # No data available on non-blocking socket; will retry
  155. except OSError as e:
  156. if self._running:
  157. logger.debug("SSDP receive error: %s", e)
  158. # Send periodic NOTIFY
  159. now = asyncio.get_event_loop().time()
  160. if now - last_notify >= notify_interval:
  161. await self._send_notify()
  162. last_notify = now
  163. await asyncio.sleep(0.1)
  164. except OSError as e:
  165. if e.errno == 98: # Address already in use
  166. logger.warning("SSDP port %s in use - real printers may be running", SSDP_PORT)
  167. else:
  168. logger.error("SSDP server error: %s", e)
  169. except asyncio.CancelledError:
  170. logger.debug("SSDP server cancelled")
  171. except Exception as e:
  172. logger.error("SSDP server error: %s", e)
  173. finally:
  174. await self._cleanup()
  175. async def stop(self) -> None:
  176. """Stop the SSDP server."""
  177. logger.info("Stopping SSDP server")
  178. self._running = False
  179. await self._cleanup()
  180. async def _cleanup(self) -> None:
  181. """Clean up resources."""
  182. if self._socket:
  183. try:
  184. # Send byebye message
  185. await self._send_byebye()
  186. except OSError:
  187. pass # Best-effort byebye broadcast; socket may already be closed
  188. try:
  189. self._socket.close()
  190. except OSError:
  191. pass # Best-effort socket close; may already be released
  192. self._socket = None
  193. async def _send_notify(self) -> None:
  194. """Send SSDP NOTIFY message via broadcast."""
  195. if not self._socket:
  196. return
  197. try:
  198. msg = self._build_notify_message()
  199. self._socket.sendto(msg, (SSDP_BROADCAST_ADDR, SSDP_PORT))
  200. logger.debug(
  201. "Sent SSDP NOTIFY for %s (Location=%s, USN=%s, bind=%s)",
  202. self.name,
  203. self._get_local_ip(),
  204. self.serial,
  205. self._bind_ip,
  206. )
  207. except OSError as e:
  208. logger.debug("Failed to send NOTIFY for %s: %s", self.name, e)
  209. async def _send_byebye(self) -> None:
  210. """Send SSDP byebye message when shutting down."""
  211. if not self._socket:
  212. return
  213. message = (
  214. "NOTIFY * HTTP/1.1\r\n"
  215. f"Host: {SSDP_MULTICAST_ADDR}:1990\r\n"
  216. f"NT: {BAMBU_SEARCH_TARGET}\r\n"
  217. "NTS: ssdp:byebye\r\n"
  218. f"USN: {self.serial}\r\n"
  219. "\r\n"
  220. )
  221. try:
  222. self._socket.sendto(message.encode(), (SSDP_BROADCAST_ADDR, SSDP_PORT))
  223. logger.debug("Sent SSDP byebye")
  224. except OSError:
  225. pass # Best-effort byebye send; network may be unavailable during shutdown
  226. async def _handle_message(self, message: str, addr: tuple[str, int]) -> None:
  227. """Handle incoming SSDP message.
  228. Args:
  229. message: The SSDP message content
  230. addr: Tuple of (ip_address, port) of sender
  231. """
  232. # Check if this is an M-SEARCH request for Bambu printers
  233. if "M-SEARCH" not in message:
  234. return
  235. # Check search target
  236. if BAMBU_SEARCH_TARGET not in message and "ssdp:all" not in message.lower():
  237. return
  238. logger.debug("Received M-SEARCH from %s", addr[0])
  239. # Send response
  240. if self._socket:
  241. try:
  242. response = self._build_response_message()
  243. self._socket.sendto(response, addr)
  244. logger.info(
  245. "Sent SSDP response to %s for '%s' (Location=%s, USN=%s)",
  246. addr[0],
  247. self.name,
  248. self._get_local_ip(),
  249. self.serial,
  250. )
  251. except OSError as e:
  252. logger.debug("Failed to send SSDP response for %s: %s", self.name, e)
  253. class SSDPProxy:
  254. """SSDP proxy that re-broadcasts printer discovery from one network to another.
  255. Listens for SSDP broadcasts from a real printer on the local interface (LAN A),
  256. then re-broadcasts them on the remote interface (LAN B) with the Location
  257. header changed to point to Bambuddy's IP on LAN B.
  258. This allows Bambu Studio on LAN B to discover the printer via Bambuddy.
  259. """
  260. def __init__(
  261. self,
  262. local_interface_ip: str,
  263. remote_interface_ip: str,
  264. target_printer_ip: str,
  265. ):
  266. """Initialize the SSDP proxy.
  267. Args:
  268. local_interface_ip: IP of interface on printer's network (LAN A)
  269. remote_interface_ip: IP of interface on slicer's network (LAN B)
  270. target_printer_ip: IP of the real printer to proxy SSDP for
  271. """
  272. self.local_interface_ip = local_interface_ip
  273. self.remote_interface_ip = remote_interface_ip
  274. self.target_printer_ip = target_printer_ip
  275. self._running = False
  276. self._local_socket: socket.socket | None = None
  277. self._remote_socket: socket.socket | None = None
  278. self._last_printer_ssdp: bytes | None = None
  279. self._printer_info: dict[str, str] = {}
  280. def _parse_ssdp_message(self, data: bytes) -> dict[str, str]:
  281. """Parse SSDP message into header dict."""
  282. headers = {}
  283. try:
  284. text = data.decode("utf-8", errors="ignore")
  285. for line in text.split("\r\n"):
  286. if ":" in line:
  287. key, value = line.split(":", 1)
  288. headers[key.strip().lower()] = value.strip()
  289. except Exception:
  290. pass # Return partial headers if parsing fails; malformed packets are common
  291. return headers
  292. def _rewrite_ssdp(self, data: bytes) -> bytes:
  293. """Rewrite SSDP message for proxy re-broadcast.
  294. - Location: changed to Bambuddy's remote interface IP
  295. - DevBind: forced to 'free' so the slicer treats the proxy as a
  296. LAN-only printer (avoids cloud auth requirement for sending prints)
  297. """
  298. try:
  299. text = data.decode("utf-8", errors="ignore")
  300. original = text
  301. # Replace Location header with our remote interface IP
  302. text = re.sub(
  303. r"(Location:\s*)[\d.]+",
  304. f"\\g<1>{self.remote_interface_ip}",
  305. text,
  306. flags=re.IGNORECASE,
  307. )
  308. # Force DevBind to 'free' - ensures slicer uses LAN mode for
  309. # both monitoring AND sending prints through the proxy
  310. text = re.sub(
  311. r"(DevBind\.bambu\.com:\s*)\S+",
  312. r"\g<1>free",
  313. text,
  314. flags=re.IGNORECASE,
  315. )
  316. # Append " - Proxy" to printer name so it's distinguishable
  317. text = re.sub(
  318. r"(DevName\.bambu\.com:\s*)(.+)",
  319. r"\g<1>\g<2> - Proxy",
  320. text,
  321. flags=re.IGNORECASE,
  322. )
  323. if text != original:
  324. logger.debug("Rewrote SSDP for proxy:\n%s", text)
  325. else:
  326. logger.warning("SSDP rewrite had no effect. Packet:\n%s", original)
  327. return text.encode("utf-8")
  328. except Exception as e:
  329. logger.error("Failed to rewrite SSDP: %s", e)
  330. return data
  331. async def start(self) -> None:
  332. """Start the SSDP proxy."""
  333. if self._running:
  334. return
  335. logger.info(
  336. f"Starting SSDP proxy: listening on {self.local_interface_ip} (LAN A), "
  337. f"broadcasting on {self.remote_interface_ip} (LAN B), "
  338. f"proxying printer {self.target_printer_ip}"
  339. )
  340. self._running = True
  341. try:
  342. # Create socket for listening on LAN A (printer network)
  343. # Bind to 0.0.0.0 to receive broadcast packets (255.255.255.255)
  344. # We filter by source IP in the handler
  345. self._local_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
  346. self._local_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  347. try:
  348. self._local_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
  349. except (AttributeError, OSError):
  350. pass # SO_REUSEPORT not available on all platforms; non-critical
  351. self._local_socket.setblocking(False)
  352. # Bind to all interfaces to receive broadcasts
  353. self._local_socket.bind(("", SSDP_PORT))
  354. # Join multicast group on local interface (for multicast SSDP if used)
  355. mreq = struct.pack(
  356. "4s4s",
  357. socket.inet_aton(SSDP_MULTICAST_ADDR),
  358. socket.inet_aton(self.local_interface_ip),
  359. )
  360. self._local_socket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
  361. self._local_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
  362. # Create socket for broadcasting on LAN B (slicer network)
  363. self._remote_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
  364. self._remote_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  365. try:
  366. self._remote_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
  367. except (AttributeError, OSError):
  368. pass # SO_REUSEPORT not available on all platforms; non-critical
  369. self._remote_socket.setblocking(False)
  370. # Bind to remote interface
  371. self._remote_socket.bind((self.remote_interface_ip, 0))
  372. self._remote_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
  373. logger.info(
  374. "SSDP proxy listening on 0.0.0.0:%s (filtering for printer %s)", SSDP_PORT, self.target_printer_ip
  375. )
  376. logger.info("SSDP proxy will broadcast on %s", self.remote_interface_ip)
  377. # Main loop
  378. last_broadcast = 0.0
  379. broadcast_interval = 30.0 # Re-broadcast every 30 seconds
  380. while self._running:
  381. # Listen for SSDP from printer on LAN A
  382. try:
  383. data, addr = self._local_socket.recvfrom(4096)
  384. await self._handle_local_packet(data, addr)
  385. except BlockingIOError:
  386. pass # No data available on non-blocking socket; will retry
  387. except OSError as e:
  388. if self._running:
  389. logger.debug("SSDP proxy receive error: %s", e)
  390. # Listen for M-SEARCH from slicer on LAN B (via remote socket would need separate bind)
  391. # For now, we periodically re-broadcast cached printer SSDP
  392. now = asyncio.get_event_loop().time()
  393. if self._last_printer_ssdp and now - last_broadcast >= broadcast_interval:
  394. await self._broadcast_to_remote()
  395. last_broadcast = now
  396. await asyncio.sleep(0.1)
  397. except OSError as e:
  398. logger.error("SSDP proxy error: %s", e)
  399. except asyncio.CancelledError:
  400. logger.debug("SSDP proxy cancelled")
  401. except Exception as e:
  402. logger.error("SSDP proxy error: %s", e)
  403. finally:
  404. await self._cleanup()
  405. async def stop(self) -> None:
  406. """Stop the SSDP proxy."""
  407. logger.info("Stopping SSDP proxy")
  408. self._running = False
  409. await self._cleanup()
  410. async def _cleanup(self) -> None:
  411. """Clean up resources."""
  412. for sock in [self._local_socket, self._remote_socket]:
  413. if sock:
  414. try:
  415. sock.close()
  416. except OSError:
  417. pass # Best-effort socket close; may already be released
  418. self._local_socket = None
  419. self._remote_socket = None
  420. async def _handle_local_packet(self, data: bytes, addr: tuple[str, int]) -> None:
  421. """Handle SSDP packet received on local interface (LAN A).
  422. Processes two types of traffic:
  423. - NOTIFY from the real printer → cache and re-broadcast on LAN B
  424. - M-SEARCH from slicers on LAN B → respond with cached printer info
  425. """
  426. sender_ip = addr[0]
  427. # Ignore packets from our own interfaces (prevent loops)
  428. if sender_ip in (self.local_interface_ip, self.remote_interface_ip):
  429. return
  430. # Handle M-SEARCH from slicers (any IP that's not the target printer)
  431. if sender_ip != self.target_printer_ip:
  432. if b"M-SEARCH" in data:
  433. await self._respond_to_msearch(data, addr)
  434. return
  435. # Below: NOTIFY handling from the real printer
  436. # Check if it's a NOTIFY message
  437. if b"NOTIFY" not in data and b"HTTP/1.1 200" not in data:
  438. return
  439. # Check if it's a Bambu printer SSDP
  440. if b"bambulab-com:device:3dprinter" not in data:
  441. return
  442. # Parse and store printer info
  443. headers = self._parse_ssdp_message(data)
  444. if headers:
  445. self._printer_info = headers
  446. logger.debug("Received SSDP from printer %s: %s", sender_ip, headers.get("devname.bambu.com", "unknown"))
  447. # Store and immediately broadcast
  448. self._last_printer_ssdp = data
  449. await self._broadcast_to_remote()
  450. async def _respond_to_msearch(self, data: bytes, addr: tuple[str, int]) -> None:
  451. """Respond to M-SEARCH from a slicer with cached, rewritten printer info.
  452. When Bambu Studio sends an M-SEARCH (e.g., before sending a print),
  453. we respond with the cached printer info, rewritten to point to the
  454. proxy's LAN B IP. Without this, the slicer thinks the printer is
  455. offline and shows a 'connect to printer' modal.
  456. """
  457. # Check if it's a relevant M-SEARCH
  458. if b"bambulab-com:device:3dprinter" not in data and b"ssdp:all" not in data.lower():
  459. return
  460. if not self._last_printer_ssdp:
  461. logger.debug("M-SEARCH from %s but no cached printer SSDP yet", addr[0])
  462. return
  463. logger.debug("Received M-SEARCH from slicer %s", addr[0])
  464. # Rewrite the cached printer SSDP (Location → proxy IP, DevBind → free)
  465. rewritten = self._rewrite_ssdp(self._last_printer_ssdp)
  466. text = rewritten.decode("utf-8", errors="ignore")
  467. # Convert NOTIFY format to M-SEARCH response format:
  468. # "NOTIFY * HTTP/1.1" → "HTTP/1.1 200 OK"
  469. # NT: → ST: (Notification Type → Search Target)
  470. # Remove NTS: header (only in NOTIFY)
  471. text = re.sub(r"^NOTIFY \* HTTP/1\.1", "HTTP/1.1 200 OK", text)
  472. text = re.sub(r"^NT:", "ST:", text, flags=re.MULTILINE)
  473. text = re.sub(r"^NTS:.*\r\n", "", text, flags=re.MULTILINE)
  474. # Send unicast response directly to the slicer via remote socket
  475. if self._remote_socket:
  476. try:
  477. self._remote_socket.sendto(text.encode("utf-8"), addr)
  478. logger.info("Sent SSDP M-SEARCH response to %s", addr[0])
  479. except OSError as e:
  480. logger.debug("Failed to send M-SEARCH response to %s: %s", addr[0], e)
  481. async def _broadcast_to_remote(self) -> None:
  482. """Broadcast cached printer SSDP on remote interface (LAN B)."""
  483. if not self._remote_socket or not self._last_printer_ssdp:
  484. return
  485. try:
  486. # Rewrite Location to point to Bambuddy's remote interface
  487. rewritten = self._rewrite_ssdp(self._last_printer_ssdp)
  488. # Calculate broadcast address for remote network
  489. # Use 255.255.255.255 for simplicity (works across subnets)
  490. self._remote_socket.sendto(rewritten, (SSDP_BROADCAST_ADDR, SSDP_PORT))
  491. printer_name = self._printer_info.get("devname.bambu.com", "unknown")
  492. logger.debug("Broadcast SSDP for '%s' on LAN B (%s)", printer_name, self.remote_interface_ip)
  493. except OSError as e:
  494. logger.debug("Failed to broadcast SSDP on remote: %s", e)