MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / retryPendingWrites

Method retryPendingWrites

Libraries/AsyncStreams/AsyncStreams.cpp:1399–1431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1397}
1398
1399bool AsyncPipeline::retryPendingWrites()
1400{
1401 for (PendingWrite& pendingWrite : pendingWrites)
1402 {
1403 if (not pendingWrite.bufferID.isValid())
1404 continue;
1405
1406 SC_ASYNC_STREAMS_ASSERT_RELEASE(pendingWrite.writable != nullptr);
1407 if (not pendingWrite.writable->canAcceptWrite())
1408 {
1409 continue;
1410 }
1411
1412 Function<void(AsyncBufferView::ID)> func;
1413 func.template bind<AsyncPipeline, &AsyncPipeline::afterWrite>(*this);
1414 const Result res = pendingWrite.writable->write(pendingWrite.bufferID, func);
1415 if (res)
1416 {
1417 pendingWrite.readable = nullptr;
1418 pendingWrite.writable = nullptr;
1419 pendingWrite.bufferID = {};
1420 }
1421 else
1422 {
1423 source->getBuffersPool().unrefBuffer(pendingWrite.bufferID);
1424 pendingWrite.readable = nullptr;
1425 pendingWrite.writable = nullptr;
1426 pendingWrite.bufferID = {};
1427 eventError.emit(res);
1428 }
1429 }
1430 return not hasPendingWrites();
1431}
1432
1433void AsyncPipeline::afterWrite(AsyncBufferView::ID bufferID)
1434{

Callers

nothing calls this directly

Calls 3

unrefBufferMethod · 0.80
isValidMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected