mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Proper OTR deadlines
This commit is contained in:
parent
035f107ab5
commit
4238df3e9f
@ -64,7 +64,10 @@ public:
|
||||
class UAVCAN_EXPORT IOutgoingTransferRegistry
|
||||
{
|
||||
public:
|
||||
static const MonotonicDuration MinEntryLifetime;
|
||||
|
||||
virtual ~IOutgoingTransferRegistry() { }
|
||||
|
||||
virtual TransferID* accessOrCreate(const OutgoingTransferRegistryKey& key, MonotonicTime new_deadline) = 0;
|
||||
virtual bool exists(DataTypeID dtid, TransferType tt) const = 0;
|
||||
virtual void cleanup(MonotonicTime deadline) = 0;
|
||||
|
||||
@ -19,4 +19,9 @@ std::string OutgoingTransferRegistryKey::toString() const
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IOutgoingTransferRegistry
|
||||
*/
|
||||
const MonotonicDuration IOutgoingTransferRegistry::MinEntryLifetime = MonotonicDuration::fromMSec(2000);
|
||||
|
||||
}
|
||||
|
||||
@ -152,7 +152,8 @@ int TransferSender::send(const uint8_t* payload, unsigned payload_len, Monotonic
|
||||
const OutgoingTransferRegistryKey otr_key(data_type_id_, transfer_type, dst_node_id);
|
||||
|
||||
UAVCAN_ASSERT(!tx_deadline.isZero());
|
||||
const MonotonicTime otr_deadline = tx_deadline + max_transfer_interval_ * 2;
|
||||
const MonotonicTime otr_deadline = tx_deadline + max(max_transfer_interval_ * 2,
|
||||
IOutgoingTransferRegistry::MinEntryLifetime);
|
||||
|
||||
TransferID* const tid = dispatcher_.getOutgoingTransferRegistry().accessOrCreate(otr_key, otr_deadline);
|
||||
if (tid == NULL)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user