Exemplo n.º 1
0
bool Message::getTtl(uint64_t ttl) const
{
    if (encoding->getTtl(ttl) && expiration < FAR_FUTURE) {
        sys::Duration remaining(sys::AbsTime::now(), getExpiration());
        // convert from ns to ms; set to 0 if expired
        ttl = (int64_t(remaining) >= 1000000 ? int64_t(remaining)/1000000 : 0);
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 2
0
uint64_t Message::getTtl() const
{
    uint64_t ttl;
    if (encoding->getTtl(ttl) && expiration < FAR_FUTURE) {
        sys::AbsTime current(
            expiryPolicy ? expiryPolicy->getCurrentTime() : sys::AbsTime::now());
        sys::Duration ttl(current, getExpiration());
        // convert from ns to ms; set to 1 if expired
        return (int64_t(ttl) >= 1000000 ? int64_t(ttl)/1000000 : 1);
    } else {
        return 0;
    }
}
Exemplo n.º 3
0
 //! Test if request expired.
 //! @return true if request expired, false otherwise.
 bool
 hasExpired(void) const
 {
   return DUNE::Time::Clock::get() > getExpiration();
 }