fix(session): report is_alive from the driver's own session
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m5s
driver / test (3.12) (pull_request) Successful in 1m3s
driver / lowest (pull_request) Successful in 34s
driver / test (3.13) (pull_request) Successful in 1m9s
driver / build (pull_request) Successful in 31s
driver / security (pull_request) Successful in 1m12s
CI / driver (pull_request) Successful in 2m53s
driver / publish (pull_request) Skipped

is_alive() opened a TCP connection to the gateway whether or not the
driver was opened, and after close() too. NAPALM's __del__ asks it of
every collected driver, so each one connected once more and could stall
for up to five seconds. Without an open session it now answers False
and connects nowhere; with one, it reports whether the gateway still
answers on its port.

Closes #19
This commit is contained in:
Christian Manivong committed 2026-11-02 10:58:14 +01:00
1 parent 5f0c7c76b3
commit e5ce4e32b1
5 files changed
+74 -5

No files matched your search

+1 -1
View File
@@ -43,7 +43,7 @@ with driver("192.0.2.1", "admin", "secret", optional_args={"use_tls": True}) as
| `get_port_forwards`, `get_nat_translations` | DAL `NAT_PORTMAP`, else the status page |
| `get_wireless_clients`, `get_ssids`, `get_radio_status` | DAL, else the wireless page |
| `get_diagnostics` | DAL `DIAGNOSTICS` |
| `is_alive` | TCP connect to the web port |
| `is_alive` | the session is open and the web port answers; without a session `False`, no connection |
| `reboot_host` | DAL `REBOOT` |
| `restart_wifi` | DAL `WIFI_RESTART` |