diff --git a/mission/com/LiveTmTask.cpp b/mission/com/LiveTmTask.cpp index 74d79d4d..833f28c1 100644 --- a/mission/com/LiveTmTask.cpp +++ b/mission/com/LiveTmTask.cpp @@ -160,7 +160,19 @@ ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue) { } if (!ptmeLocked) { - result = channel.write(data, size); + size_t partiallyWrittenSize = 0; + result = channel.write(data, size, partiallyWrittenSize); + if (result == DirectTmSinkIF::PARTIALLY_WRITTEN) { + // Already throttle CFDP. + signals::CFDP_CHANNEL_THROTTLE_SIGNAL = true; + result = channel.handleLastWriteSynchronously(data, size, partiallyWrittenSize, 200); + if (result != returnvalue::OK) { + // TODO: Event? Might lead to dangerous spam though.. + sif::warning + << "LiveTmTask: Synchronous write of last segment failed with code 0x" + << std::setw(4) << std::hex << result << std::dec << std::endl; + } + } } // Try delete in any case, ignore failures (which should not happen), it is more important to // propagate write errors.