ENH: Optimization of File Transfer System Part1

jira: [STUDIO-11777]

Change-Id: I733fd3532caa19546763ab8a72eb7667d5ffec53
(cherry picked from commit aa52c99076a78e2c8fd8d4e4b0b64de0bc761469)
This commit is contained in:
milk
2025-04-21 21:00:14 +08:00
committed by Noisyfox
parent 70c0b116fc
commit 32c055ca7a
4 changed files with 31 additions and 1 deletions

View File

@@ -1232,7 +1232,7 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
if (m_session.owner == nullptr)
return;
json r;
while (!m_callbacks.empty()) {
while(!m_callbacks.empty()) {
auto c = m_callbacks.front();
m_callbacks.pop_front();
++m_sequence;
@@ -1245,6 +1245,8 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
while (m_stopped) {
if (m_session.owner == nullptr)
return;
m_status = Status::Stopped;
SendChangedEvent(EVT_STATUS_CHANGED, m_status);
m_cond.wait(l);
}
wxLogMessage("PrinterFileSystem::Reconnect Initializing");
@@ -1271,6 +1273,7 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
Bambu_Tunnel tunnel = nullptr;
int ret = Bambu_Create(&tunnel, url.c_str());
if (ret == 0) {
Bambu_SetLogger(tunnel, DumpLog, this);
ret = Bambu_Open(tunnel);
}
@@ -1297,6 +1300,7 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
}
wxLogMessage("PrinterFileSystem::Reconnect Failed");
m_status = Status::Failed;
SendChangedEvent(EVT_STATUS_CHANGED, m_status, "", url.size() < 2 ? 1 : m_last_error);
m_cond.timed_wait(l, boost::posix_time::seconds(10));
}