Fix LAN Bambu printer losing its connection when the cloud server connects (#17769)

The server-connected handler selects the agent's current machine again every time the cloud
server connects. For a LAN printer this makes the Bambu network plug-in unsubscribe the device,
which drops the LAN session that selecting the printer opened. A connect still in flight fails
with "called UnSubscribeDevice". One that already succeeded stays down with no connect result, so
the printer shows as connected while every command fails with -4 and Print fails with -4030.

Since #17086, OrcaSlicer connects the last LAN Bambu printer at startup, so a LAN user hits this
on most starts. A cloud reconnect later in a session drops the session the same way.

The selection is a cloud subscription, so a LAN printer does not need it. Move the re-select into
DeviceManager::reselect_cloud_machine(), which skips a LAN-mode printer and behaves as before for
any other machine.

Fixes #17766
This commit is contained in:
Alexander Vander Kelen authored and GitHub committed 2026-11-21 13:01:33 -06:00
1 parent f2eb53ebaa
commit a8a597c6d5
4 files changed
+62 -2

No files matched your search

+17
View File
@@ -865,6 +865,23 @@ namespace Slic3r
m_agent->add_subscribe(subscribe_list_cache);
}
void DeviceManager::reselect_cloud_machine()
{
if (!m_agent)
return;
// The selection is a cloud subscription, and a LAN printer has none. Selecting one makes the
// Bambu network plugin unsubscribe the device, which drops the LAN session that connected it:
// a connect still in flight fails, and one that already succeeded stays down with no connect
// result to say so.
const std::string dev_id = m_agent->get_user_selected_machine();
const MachineObject* obj = get_my_machine(dev_id);
if (obj && obj->is_lan_mode_printer())
return;
m_agent->set_user_selected_machine(dev_id);
}
std::map<std::string, MachineObject*> DeviceManager::get_my_machine_list(const std::string& agent_id)
{
std::map<std::string, MachineObject*> result;