ENH: handle printer direct close and not retry
Change-Id: I5dd55f8085cf6383a8420ab41e614ea6ae210c78 Jira: STUDIO-5305
This commit is contained in:
parent
a5c4801497
commit
99f5863ffa
|
@ -42,6 +42,7 @@ static wxBitmap default_thumbnail;
|
|||
|
||||
static std::map<int, std::string> error_messages = {
|
||||
{PrinterFileSystem::ERROR_PIPE, L("Connection lost. Please retry.")},
|
||||
{PrinterFileSystem::ERROR_RES_BUSY, L("The device cannot handle more conversations. Please retry later.")},
|
||||
{PrinterFileSystem::FILE_NO_EXIST, L("File not exists.")},
|
||||
{PrinterFileSystem::FILE_CHECK_ERR, L("File checksum error. Please retry.")},
|
||||
{PrinterFileSystem::FILE_TYPE_ERR, L("Not supported on the current printer version.")},
|
||||
|
@ -507,6 +508,7 @@ void PrinterFileSystem::Start()
|
|||
void PrinterFileSystem::Retry()
|
||||
{
|
||||
boost::unique_lock l(m_mutex);
|
||||
m_stopped = false;
|
||||
m_cond.notify_all();
|
||||
}
|
||||
|
||||
|
@ -1147,7 +1149,9 @@ void PrinterFileSystem::RecvMessageThread()
|
|||
if (n == 0) {
|
||||
HandleResponse(l, sample);
|
||||
} else if (n == Bambu_stream_end) {
|
||||
Reconnect(l, 3);
|
||||
if (m_status == ListSyncing)
|
||||
m_stopped = true;
|
||||
Reconnect(l, m_status == ListSyncing ? ERROR_RES_BUSY : ERROR_PIPE);
|
||||
} else if (n == Bambu_would_block) {
|
||||
m_cond.timed_wait(l, boost::posix_time::milliseconds(m_messages.empty() && m_callbacks.empty() ? 1000 : 20));
|
||||
} else {
|
||||
|
|
|
@ -44,6 +44,8 @@ public:
|
|||
ERROR_JSON = 2,
|
||||
ERROR_PIPE = 3,
|
||||
ERROR_CANCEL = 4,
|
||||
ERROR_RES_BUSY = 5,
|
||||
|
||||
FILE_NO_EXIST = 10,
|
||||
FILE_NAME_INVALID = 11,
|
||||
FILE_SIZE_ERR = 12,
|
||||
|
|
Loading…
Reference in New Issue