need to rework this fsm.. but works now
This commit is contained in:
parent
dfcfb035be
commit
470f589bde
@ -302,9 +302,11 @@ ReturnValue_t cfdp::DestHandler::startTransaction(const MetadataPduReader& reade
|
|||||||
transactionParams.destName[destNameSize] = '\0';
|
transactionParams.destName[destNameSize] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transactionParams.metadataOnly = true;
|
||||||
// If both dest name size and source name size are 0, we are dealing with a metadata only PDU,
|
// If both dest name size and source name size are 0, we are dealing with a metadata only PDU,
|
||||||
// so there is no need to create a file or truncate an existing file
|
// so there is no need to create a file or truncate an existing file
|
||||||
if (destNameSize > 0 and sourceNameSize > 0) {
|
if (destNameSize > 0 and sourceNameSize > 0) {
|
||||||
|
transactionParams.metadataOnly = false;
|
||||||
FilesystemParams fparams(transactionParams.destName.data());
|
FilesystemParams fparams(transactionParams.destName.data());
|
||||||
// handling to allow only specifying target directory. Example:
|
// handling to allow only specifying target directory. Example:
|
||||||
// Source path /test/hello.txt, dest path /tmp -> dest path /tmp/hello.txt
|
// Source path /test/hello.txt, dest path /tmp -> dest path /tmp/hello.txt
|
||||||
@ -341,12 +343,18 @@ ReturnValue_t cfdp::DestHandler::startTransaction(const MetadataPduReader& reade
|
|||||||
#endif
|
#endif
|
||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
fsmRes.step = TransactionStep::TRANSACTION_START;
|
|
||||||
if (reader.getTransmissionMode() == TransmissionMode::UNACKNOWLEDGED) {
|
if (reader.getTransmissionMode() == TransmissionMode::UNACKNOWLEDGED) {
|
||||||
fsmRes.state = CfdpState::BUSY_CLASS_1_NACKED;
|
fsmRes.state = CfdpState::BUSY_CLASS_1_NACKED;
|
||||||
} else if (reader.getTransmissionMode() == TransmissionMode::ACKNOWLEDGED) {
|
} else if (reader.getTransmissionMode() == TransmissionMode::ACKNOWLEDGED) {
|
||||||
fsmRes.state = CfdpState::BUSY_CLASS_2_ACKED;
|
fsmRes.state = CfdpState::BUSY_CLASS_2_ACKED;
|
||||||
}
|
}
|
||||||
|
if (transactionParams.metadataOnly) {
|
||||||
|
fsmRes.step = TransactionStep::TRANSFER_COMPLETION;
|
||||||
|
} else {
|
||||||
|
// Kind of ugly, make FSM working on packet per packet basis..
|
||||||
|
fsmRes.step = TransactionStep::TRANSACTION_START;
|
||||||
|
fsmRes.step = TransactionStep::RECEIVING_FILE_DATA_PDUS;
|
||||||
|
}
|
||||||
auto& info = reader.getGenericInfo();
|
auto& info = reader.getGenericInfo();
|
||||||
transactionParams.checksumType = info.getChecksumType();
|
transactionParams.checksumType = info.getChecksumType();
|
||||||
transactionParams.closureRequested = info.isClosureRequested();
|
transactionParams.closureRequested = info.isClosureRequested();
|
||||||
@ -355,7 +363,6 @@ ReturnValue_t cfdp::DestHandler::startTransaction(const MetadataPduReader& reade
|
|||||||
transactionParams.transactionId.entityId = transactionParams.pduConf.sourceId;
|
transactionParams.transactionId.entityId = transactionParams.pduConf.sourceId;
|
||||||
transactionParams.transactionId.seqNum = transactionParams.pduConf.seqNum;
|
transactionParams.transactionId.seqNum = transactionParams.pduConf.seqNum;
|
||||||
transactionParams.fileSize = info.getFileSize();
|
transactionParams.fileSize = info.getFileSize();
|
||||||
fsmRes.step = TransactionStep::RECEIVING_FILE_DATA_PDUS;
|
|
||||||
MetadataRecvdParams params(transactionParams.transactionId, transactionParams.pduConf.sourceId,
|
MetadataRecvdParams params(transactionParams.transactionId, transactionParams.pduConf.sourceId,
|
||||||
transactionParams.fileSize);
|
transactionParams.fileSize);
|
||||||
params.destFileName = transactionParams.destName.data();
|
params.destFileName = transactionParams.destName.data();
|
||||||
|
@ -125,11 +125,13 @@ class DestHandler {
|
|||||||
crc = 0;
|
crc = 0;
|
||||||
progress = 0;
|
progress = 0;
|
||||||
remoteCfg = nullptr;
|
remoteCfg = nullptr;
|
||||||
|
metadataOnly = false;
|
||||||
closureRequested = false;
|
closureRequested = false;
|
||||||
vfsErrorCount = 0;
|
vfsErrorCount = 0;
|
||||||
checksumType = ChecksumType::NULL_CHECKSUM;
|
checksumType = ChecksumType::NULL_CHECKSUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool metadataOnly = false;
|
||||||
ChecksumType checksumType = ChecksumType::NULL_CHECKSUM;
|
ChecksumType checksumType = ChecksumType::NULL_CHECKSUM;
|
||||||
bool closureRequested = false;
|
bool closureRequested = false;
|
||||||
uint16_t vfsErrorCount = 0;
|
uint16_t vfsErrorCount = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user