Load saved LAN printers when the device manager first gets an agent

When the network plugin is not yet installed at startup, on_init_network builds
the DeviceManager without an agent, so its constructor skips loading the persisted
LAN printers. After the plugin is installed and the network stack hot-reloads, the
manager is reused via set_agent(), which never loaded them - so previously paired
printers stayed missing from the device list until an app restart. Load them once a
real agent first arrives.
This commit is contained in:
SoftFever
2026-07-18 15:16:06 +08:00
parent 01f2af94a1
commit 5028a5000e
2 changed files with 46 additions and 20 deletions

View File

@@ -96,6 +96,13 @@ public:
std::map<std::string, std::vector<std::string>> device_subseries;
private:
// Load the LAN printers persisted in AppConfig into localMachineList. Runs from the
// constructor when an agent is available and, for the case where the DeviceManager was
// first built without one (network plugin not yet installed at startup), from set_agent()
// once a real agent finally arrives - so paired printers survive a plugin install/hot
// reload without an app restart.
void load_local_machines_from_config();
void keep_alive();
void check_pushing();