diff options
author | Sven Gothel <[email protected]> | 2023-01-01 08:58:45 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-01-01 08:58:45 +0100 |
commit | b49c5f0c10e10c5740779b6b30bb011898a74c1f (patch) | |
tree | c358f24ca70c099d1637f7e9e824fc655fefb3c7 /src/direct_bt | |
parent | c0189ff17a9baaef7b7b874256ba3bc70e1b641b (diff) |
Adopt to jaulib ringbuffer changes v1.0.1-8-g854a714
Diffstat (limited to 'src/direct_bt')
-rw-r--r-- | src/direct_bt/BTGattHandler.cpp | 6 | ||||
-rw-r--r-- | src/direct_bt/BTManager.cpp | 6 | ||||
-rw-r--r-- | src/direct_bt/HCIHandler.cpp | 6 | ||||
-rw-r--r-- | src/direct_bt/SMPHandler.cpp | 6 |
4 files changed, 20 insertions, 4 deletions
diff --git a/src/direct_bt/BTGattHandler.cpp b/src/direct_bt/BTGattHandler.cpp index bbf60be7..22efe303 100644 --- a/src/direct_bt/BTGattHandler.cpp +++ b/src/direct_bt/BTGattHandler.cpp @@ -526,7 +526,11 @@ void BTGattHandler::l2capReaderWork(jau::service_runner& sr) noexcept { } } else if( AttPDUMsg::OpcodeType::RESPONSE == opc_type ) { COND_PRINT(env.DEBUG_DATA, "GATTHandler::reader: Ring: %s", attPDU->toString().c_str()); - attPDURing.putBlocking( std::move(attPDU), 0_s ); + if( !attPDURing.putBlocking( std::move(attPDU), 0_s ) ) { + ERR_PRINT2("attPDURing put: %s", attPDURing.toString().c_str()); + sr.set_shall_stop(); + return; + } } else if( AttPDUMsg::OpcodeType::REQUEST == opc_type ) { if( !replyAttPDUReq( std::move( attPDU ) ) ) { ERR_PRINT2("ATT Reply: %s", toString().c_str()); diff --git a/src/direct_bt/BTManager.cpp b/src/direct_bt/BTManager.cpp index f21eac48..733f9cfd 100644 --- a/src/direct_bt/BTManager.cpp +++ b/src/direct_bt/BTManager.cpp @@ -104,7 +104,11 @@ void BTManager::mgmtReaderWork(jau::service_runner& sr) noexcept { mgmtEventRing.drop(dropCount); WARN_PRINT("BTManager-IO RECV Drop (%u oldest elements of %u capacity, ring full)", dropCount, mgmtEventRing.capacity()); } - mgmtEventRing.putBlocking( std::move( event ), 0_s ); + if( !mgmtEventRing.putBlocking( std::move( event ), 0_s ) ) { + ERR_PRINT2("mgmtEventRing put: %s", mgmtEventRing.toString().c_str()); + sr.set_shall_stop(); + return; + } } else if( MgmtEvent::Opcode::INDEX_ADDED == opc ) { COND_PRINT(env.DEBUG_EVENT, "BTManager-IO RECV (ADD) %s", event->toString().c_str()); std::thread adapterAddedThread(&BTManager::processAdapterAdded, this, std::move( event) ); // @suppress("Invalid arguments") diff --git a/src/direct_bt/HCIHandler.cpp b/src/direct_bt/HCIHandler.cpp index 46e3da38..f79e86d9 100644 --- a/src/direct_bt/HCIHandler.cpp +++ b/src/direct_bt/HCIHandler.cpp @@ -523,7 +523,11 @@ void HCIHandler::hciReaderWork(jau::service_runner& sr) noexcept { WARN_PRINT("dev_id %u: IO RECV Drop (%u oldest elements of %u capacity, ring full) - %s", dev_id, dropCount, hciEventRing.capacity(), toString().c_str()); } - hciEventRing.putBlocking( std::move( event ), jau::fractions_i64::zero ); + if( !hciEventRing.putBlocking( std::move( event ), jau::fractions_i64::zero ) ) { + ERR_PRINT2("hciEventRing put: %s", hciEventRing.toString().c_str()); + sr.set_shall_stop(); + return; + } } else if( event->isMetaEvent(HCIMetaEventType::LE_ADVERTISING_REPORT) ) { // issue callbacks for the translated AD events jau::darray<std::unique_ptr<EInfoReport>> eirlist = EInfoReport::read_ad_reports(event->getParam(), event->getParamSize()); diff --git a/src/direct_bt/SMPHandler.cpp b/src/direct_bt/SMPHandler.cpp index 469886f0..0fcc2697 100644 --- a/src/direct_bt/SMPHandler.cpp +++ b/src/direct_bt/SMPHandler.cpp @@ -122,7 +122,11 @@ void SMPHandler::smpReaderWork(jau::service_runner& sr) noexcept { smpPDURing.drop(dropCount); WARN_PRINT("SMPHandler-IO RECV Drop (%u oldest elements of %u capacity, ring full)", dropCount, smpPDURing.capacity()); } - smpPDURing.putBlocking( std::move(smpPDU), 0_s ); + if( !smpPDURing.putBlocking( std::move(smpPDU), 0_s ) ) { + ERR_PRINT2("smpPDURing put: %s", smpPDURing.toString().c_str()); + sr.set_shall_stop(); + return; + } } } else if( len == L2CAPClient::number(L2CAPClient::RWExitCode::INTERRUPTED) ) { WORDY_PRINT("SMPHandler::reader: l2cap read: IRQed res %d (%s); %s", |