Skip to content

Commit

Permalink
fixup! fix: prevent deadlockwith stuck bulk transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed Oct 11, 2024
1 parent 74de707 commit fbd5fe5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/controllers/bulk/bulkcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
#include "util/trace.h"

namespace {
using namespace std::literals;
constexpr std::seconds kBulkSendTimeout = 5s;
} // namespace
constexpr unsigned int kBulkSendTimeoutMs = 5000; // In milliseconds
}

Check warning on line 14 in src/controllers/bulk/bulkcontroller.cpp

View workflow job for this annotation

GitHub Actions / clang-tidy

anonymous namespace not terminated with a closing comment [google-readability-namespace-comments]

BulkReader::BulkReader(libusb_device_handle *handle, unsigned char in_epaddr)
: QThread(),
Expand Down Expand Up @@ -305,10 +304,11 @@ void BulkController::sendBytes(const QByteArray& data) {
(unsigned char*)data.constData(),
data.size(),
&transferred,
std::milliseconds(kBulkSendTimeout).count();
kBulkSendTimeoutMs);
if (ret < 0) {
qCWarning(m_logOutput) << "Unable to send data to" << getName()
<< "serial #" << m_sUID << "-" << libusb_error_name(ret);
;
} else if (CmdlineArgs::Instance().getControllerDebug()) {
qCDebug(m_logOutput) << transferred << "bytes sent to" << getName()
<< "serial #" << m_sUID;
Expand Down

0 comments on commit fbd5fe5

Please sign in to comment.