MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / insert

Method insert

dds/DCPS/security/AccessControlBuiltInImpl.cpp:1590–1631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1588}
1589
1590void
1591AccessControlBuiltInImpl::RevokePermissions::insert(::DDS::Security::PermissionsHandle pm_handle,
1592 const time_t& expiration)
1593{
1594 ACE_GUARD(ACE_Thread_Mutex, guard, lock_);
1595
1596 if (handle_to_expiration_.count(pm_handle)) {
1597 return;
1598 }
1599
1600 const time_t current_date_time = time(0);
1601 tm* current_time_tm = gmtime(&current_date_time);
1602 const time_t cur_utc_time = mktime(current_time_tm);
1603 const TimeDuration duration = std::min(TimeDuration(expiration - cur_utc_time), MAX_DURATION);
1604
1605 const bool empty_before = expiration_to_handle_.empty();
1606
1607 handle_to_expiration_[pm_handle] = expiration;
1608
1609 if (DCPS::security_debug.bookkeeping) {
1610 ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {bookkeeping} ")
1611 ACE_TEXT("AccessControlBuiltInImpl::RevokePermissions::insert handle_to_expiration_ (total %B)\n"),
1612 handle_to_expiration_.size()));
1613 }
1614
1615 ExpirationToHandle::const_iterator pos =
1616 expiration_to_handle_.insert(ExpirationToHandle::value_type(expiration, pm_handle));
1617
1618 if (DCPS::security_debug.bookkeeping) {
1619 ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {bookkeeping} ")
1620 ACE_TEXT("AccessControlBuiltInImpl::RevokePermissions::insert expiration_to_handle_ (total %B)\n"),
1621 expiration_to_handle_.size()));
1622 }
1623
1624 if (!empty_before && pos == expiration_to_handle_.begin()) {
1625 revokation_event_->cancel();
1626 }
1627
1628 if (pos == expiration_to_handle_.begin()) {
1629 revokation_event_->schedule(duration);
1630 }
1631}
1632
1633void
1634AccessControlBuiltInImpl::RevokePermissions::erase(::DDS::Security::PermissionsHandle pm_handle)

Calls 6

countMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
cancelMethod · 0.45
scheduleMethod · 0.45

Tested by 1

test_equalityFunction · 0.36