本文整理汇总了C++中LOG_TRACE函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_TRACE函数的具体用法?C++ LOG_TRACE怎么用?C++ LOG_TRACE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOG_TRACE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aTest
int TaskManager::loadWorker(std::string workerFileName, OSFileSys* fsys)
{
int result = 0;
int errorCount = 0;
std::auto_ptr<EParser> aTest(new EParser(m_ostr));
//EParser* aTest = new EParser(m_ostr);
aTest->setFilename(workerFileName);
int res = aTest->extractInclude(workerFileName, TaskConfig::getDeployHome());
if(res != 0){
result = res;
errorCount = res;
}
if(aTest->getInclude() != 0){
//preprocessing include
EList<std::string> includedFiles = aTest->getInclude()->getIncludeFiles();
if(includedFiles.moveHead()){
do{
std::string fName = includedFiles.getCurObject();
//parsing
LOG_TRACE(m_log, "Reading the file, '%s'...", fName.c_str());
aTest->setFilename(fName);
errorCount = aTest->parseScript(TaskConfig::getDeployHome() + fName);
if(errorCount>0){
result = errorCount; ///////////////////////////////////에러코드정리
LOG_ERROR(m_log, "Parser can not open the file '%s'.", fName.c_str());
break;
}
}
while(includedFiles.moveNext());
}
}
if(errorCount == 0){
GparsedResult* pRslt = aTest->getParsingResult();
EList<Genum*>* enumlist = pRslt->getEnums();
EList<Gmodel*>* modellist = pRslt->getModels();
EList<Gaction*>* actionlist = pRslt->getActions();
// EList<Gworker*>* workerlist = pRslt->getWorkers(); //예전 방법 task 정의
EList<Gtask*>* tasklist = pRslt->getTasks(); //최근 방법 task 정의
EList<Gbehavior*>* bhvlist = pRslt->getbehaviors();
EList<Gconnector*>* connlist = pRslt->getconnectors();
SymTAB4Task* newSymT = new SymTAB4Task();
std::auto_ptr<RTObjBuilder> rtmBuilder(new RTObjBuilder(m_ostr, newSymT));
//RTObjBuilder *rtmBuilder = new RTObjBuilder(m_ostr, newSymT);
EList<RFSMtask*>* rtasks = NULL;
EList<RFSMbehavior*>* rbhvs = NULL;
EList<RFSMconnector*>* rconns = NULL;
try{
//model, action, enum 검사
LOG_TRACE(m_log, "Checking Model composed of Symbol, Function, Action and Enum ...");
rtmBuilder->makeSymTable(pRslt);
//TASK 명세 검사
LOG_TRACE(m_log, "Checking Tasks ...");
rtasks = rtmBuilder->checkSemantics(tasklist);
rbhvs = rtmBuilder->checkSemantics(bhvlist);
rconns = rtmBuilder->checkSemantics(connlist);
//Model 파일수가 여러개 이더라도 1개의 심볼테이블이 만들어진다.
//파일이 나누어져도 하나의 파일로 간주
//SymTAB4Task* newSymT = rtmBuilder->getSymT();
/*
if(workerlist !=NULL && workerlist->getSize()>0 && workerlist->moveHead()){
do{
Gworker* worker = workerlist->getCurObject();
std::string workerName = worker->getName()->getData();
//Task 들을 등록
result = m_taskMem->addTask(workerName, worker->getStartBhv()->getData());
//심볼테이블 등록
if(result ==0){
newSymT->pluRefCount();
result = m_taskMem->addSymbolT(workerName, newSymT);
}
else
result = 100; ///////////////////////////////////에러코드정리
}
while(workerlist->moveNext());
}
*/
if(rtasks !=NULL && rtasks->getSize()>0 && rtasks->moveHead()){
do{
RFSMtask* task = rtasks->getCurObject();
std::string taskName = task->getName();
//Task 들을 등록
result = m_taskMem->addTask2(taskName, task);
//여기까지 했다 다음부터 구현 할 것
//.........这里部分代码省略.........
示例2: lock
template < typename IN_PORT_TYPE, typename OUT_PORT_TYPE > int add_const_vii_base::_transformerServiceFunction( typename std::vector< gr_istream< IN_PORT_TYPE > > &istreams ,
typename std::vector< gr_ostream< OUT_PORT_TYPE > > &ostreams )
{
typedef typename std::vector< gr_istream< IN_PORT_TYPE > > _IStreamList;
typedef typename std::vector< gr_ostream< OUT_PORT_TYPE > > _OStreamList;
boost::mutex::scoped_lock lock(serviceThreadLock);
if ( validGRBlock() == false ) {
// create our processing block, and setup property notifiers
createBlock();
LOG_DEBUG( add_const_vii_base, " FINISHED BUILDING GNU RADIO BLOCK");
}
//process any Stream ID changes this could affect number of io streams
processStreamIdChanges();
if ( !validGRBlock() || istreams.size() == 0 || ostreams.size() == 0 ) {
LOG_WARN( add_const_vii_base, "NO STREAMS ATTACHED TO BLOCK..." );
return NOOP;
}
_input_ready.resize( istreams.size() );
_ninput_items_required.resize( istreams.size() );
_ninput_items.resize( istreams.size() );
_input_items.resize( istreams.size() );
_output_items.resize( ostreams.size() );
//
// RESOLVE: need to look at forecast strategy,
// 1) see how many read items are necessary for N number of outputs
// 2) read input data and see how much output we can produce
//
//
// Grab available data from input streams
//
typename _OStreamList::iterator ostream;
typename _IStreamList::iterator istream = istreams.begin();
int nitems=0;
for ( int idx=0 ; istream != istreams.end() && serviceThread->threadRunning() ; idx++, istream++ ) {
// note this a blocking read that can cause deadlocks
nitems = istream->read();
if ( istream->overrun() ) {
LOG_WARN( add_const_vii_base, " NOT KEEPING UP WITH STREAM ID:" << istream->streamID );
}
if ( istream->sriChanged() ) {
// RESOLVE - need to look at how SRI changes can affect Gnu Radio BLOCK state
LOG_DEBUG( add_const_vii_base, "SRI CHANGED, STREAMD IDX/ID: "
<< idx << "/" << istream->pkt->streamID );
setOutputStreamSRI( idx, istream->pkt->SRI );
}
}
LOG_TRACE( add_const_vii_base, "READ NITEMS: " << nitems );
if ( nitems <= 0 && !_istreams[0].eos() ) {
return NOOP;
}
bool eos = false;
int nout = 0;
bool workDone = false;
while ( nout > -1 && serviceThread->threadRunning() ) {
eos = false;
nout = _forecastAndProcess( eos, istreams, ostreams );
if ( nout > -1 ) {
workDone = true;
// we chunked on data so move read pointer..
istream = istreams.begin();
for ( ; istream != istreams.end(); istream++ ) {
int idx=std::distance( istreams.begin(), istream );
// if we processed data for this stream
if ( _input_ready[idx] ) {
size_t nitems = 0;
try {
nitems = gr_sptr->nitems_read( idx );
} catch(...){}
if ( nitems > istream->nitems() ) {
LOG_WARN( add_const_vii_base, "WORK CONSUMED MORE DATA THAN AVAILABLE, READ/AVAILABLE "
<< nitems << "/" << istream->nitems() );
nitems = istream->nitems();
}
istream->consume( nitems );
LOG_TRACE( add_const_vii_base, " CONSUME READ DATA ITEMS/REMAIN " << nitems << "/" << istream->nitems());
}
}
gr_sptr->reset_read_index();
}
// check for not enough data return
if ( nout == -1 ) {
// check for end of stream
//.........这里部分代码省略.........
示例3: esm_send_activate_default_eps_bearer_context_request
/****************************************************************************
** **
** Name: esm_send_activate_default_eps_bearer_context_request() **
** **
** Description: Builds Activate Default EPS Bearer Context Request **
** message **
** **
** The activate default EPS bearer context request message **
** is sent by the network to the UE to request activation of **
** a default EPS bearer context. **
** **
** Inputs: pti: Procedure transaction identity **
** ebi: EPS bearer identity **
** qos: Subscribed EPS quality of service **
** apn: Access Point Name in used **
** pdn_addr: PDN IPv4 address and/or IPv6 suffix **
** esm_cause: ESM cause code **
** Others: None **
** **
** Outputs: msg: The ESM message to be sent **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int
esm_send_activate_default_eps_bearer_context_request (
int pti,
int ebi,
activate_default_eps_bearer_context_request_msg * msg,
const OctetString * apn,
const ProtocolConfigurationOptions * pco,
int pdn_type,
const OctetString * pdn_addr,
const EpsQualityOfService * qos,
int esm_cause)
{
LOG_FUNC_IN;
/*
* Mandatory - ESM message header
*/
msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
msg->epsbeareridentity = ebi;
msg->messagetype = ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST;
msg->proceduretransactionidentity = pti;
/*
* Mandatory - EPS QoS
*/
msg->epsqos = *qos;
LOG_TRACE (INFO, "ESM-SAP - epsqos qci: %u", qos->qci);
if (qos->bitRatesPresent) {
LOG_TRACE (INFO, "ESM-SAP - epsqos maxBitRateForUL: %u", qos->bitRates.maxBitRateForUL);
LOG_TRACE (INFO, "ESM-SAP - epsqos maxBitRateForDL: %u", qos->bitRates.maxBitRateForDL);
LOG_TRACE (INFO, "ESM-SAP - epsqos guarBitRateForUL: %u", qos->bitRates.guarBitRateForUL);
LOG_TRACE (INFO, "ESM-SAP - epsqos guarBitRateForDL: %u", qos->bitRates.guarBitRateForDL);
} else {
LOG_TRACE (INFO, "ESM-SAP - epsqos no bit rates defined");
}
if (qos->bitRatesExtPresent) {
LOG_TRACE (INFO, "ESM-SAP - epsqos maxBitRateForUL Ext: %u", qos->bitRatesExt.maxBitRateForUL);
LOG_TRACE (INFO, "ESM-SAP - epsqos maxBitRateForDL Ext: %u", qos->bitRatesExt.maxBitRateForDL);
LOG_TRACE (INFO, "ESM-SAP - epsqos guarBitRateForUL Ext: %u", qos->bitRatesExt.guarBitRateForUL);
LOG_TRACE (INFO, "ESM-SAP - epsqos guarBitRateForDL Ext: %u", qos->bitRatesExt.guarBitRateForDL);
} else {
LOG_TRACE (INFO, "ESM-SAP - epsqos no bit rates ext defined");
}
if ((apn == NULL) || ((apn != NULL) && (apn->value == NULL))) {
LOG_TRACE (WARNING, "ESM-SAP - apn is NULL!");
}
LOG_TRACE (INFO, "ESM-SAP - apn is %s", apn->value);
/*
* Mandatory - Access Point Name
*/
msg->accesspointname.accesspointnamevalue = *apn;
/*
* Mandatory - PDN address
*/
LOG_TRACE (INFO, "ESM-SAP - pdn_type is %u", pdn_type);
msg->pdnaddress.pdntypevalue = pdn_type;
LOG_TRACE (INFO, "ESM-SAP - pdn_addr is %u", dump_octet_string (pdn_addr));
msg->pdnaddress.pdnaddressinformation = *pdn_addr;
/*
* Optional - ESM cause code
*/
msg->presencemask = 0;
if (esm_cause != ESM_CAUSE_SUCCESS) {
msg->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT;
msg->esmcause = esm_cause;
}
if (pco != NULL) {
msg->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT;
msg->protocolconfigurationoptions = *pco;
}
#warning "TEST LG FORCE APN-AMBR"
LOG_TRACE (INFO, "ESM-SAP - FORCE APN-AMBR");
//.........这里部分代码省略.........
示例4: PL_ASSERT
bool HybridScanExecutor::ExecPrimaryIndexLookup() {
PL_ASSERT(index_done_ == false);
const planner::HybridScanPlan &node = GetPlanNode<planner::HybridScanPlan>();
bool acquire_owner = GetPlanNode<planner::AbstractScan>().IsForUpdate();
auto key_column_ids_ = node.GetKeyColumnIds();
auto expr_type_ = node.GetExprTypes();
std::vector<ItemPointer *> tuple_location_ptrs;
PL_ASSERT(index_->GetIndexType() == INDEX_CONSTRAINT_TYPE_PRIMARY_KEY);
if (0 == key_column_ids_.size()) {
LOG_TRACE("Scan all keys");
index_->ScanAllKeys(tuple_location_ptrs);
} else {
LOG_TRACE("Scan");
index_->Scan(values_,
key_column_ids_,
expr_type_,
SCAN_DIRECTION_TYPE_FORWARD,
tuple_location_ptrs,
&node.GetIndexPredicate().GetConjunctionList()[0]);
}
LOG_TRACE("Result tuple count: %lu", tuple_location_ptrs.size());
auto &transaction_manager =
concurrency::TransactionManagerFactory::GetInstance();
auto current_txn = executor_context_->GetTransaction();
if (tuple_location_ptrs.size() == 0) {
index_done_ = true;
return false;
}
std::map<oid_t, std::vector<oid_t>> visible_tuples;
// for every tuple that is found in the index.
for (auto tuple_location_ptr : tuple_location_ptrs) {
ItemPointer tuple_location = *tuple_location_ptr;
if (type_ == HYBRID_SCAN_TYPE_HYBRID &&
tuple_location.block >= (block_threshold)) {
item_pointers_.insert(tuple_location);
}
auto &manager = catalog::Manager::GetInstance();
auto tile_group = manager.GetTileGroup(tuple_location.block);
auto tile_group_header = tile_group.get()->GetHeader();
// perform transaction read
size_t chain_length = 0;
while (true) {
++chain_length;
auto visibility = transaction_manager.IsVisible(current_txn, tile_group_header, tuple_location.offset);
if (visibility == VISIBILITY_OK) {
visible_tuples[tuple_location.block].push_back(tuple_location.offset);
auto res = transaction_manager.PerformRead(current_txn, tuple_location, acquire_owner);
if (!res) {
transaction_manager.SetTransactionResult(current_txn, RESULT_FAILURE);
return res;
}
break;
} else {
ItemPointer old_item = tuple_location;
cid_t old_end_cid = tile_group_header->GetEndCommitId(old_item.offset);
tuple_location = tile_group_header->GetNextItemPointer(old_item.offset);
// there must exist a visible version.
assert(tuple_location.IsNull() == false);
cid_t max_committed_cid = transaction_manager.GetMaxCommittedCid();
// check whether older version is garbage.
if (old_end_cid < max_committed_cid) {
assert(tile_group_header->GetTransactionId(old_item.offset) ==
INITIAL_TXN_ID ||
tile_group_header->GetTransactionId(old_item.offset) ==
INVALID_TXN_ID);
if (tile_group_header->SetAtomicTransactionId(
old_item.offset, INVALID_TXN_ID) == true) {
// atomically swap item pointer held in the index bucket.
AtomicUpdateItemPointer(tuple_location_ptr, tuple_location);
}
}
tile_group = manager.GetTileGroup(tuple_location.block);
tile_group_header = tile_group.get()->GetHeader();
}
}
}
// Construct a logical tile for each block
//.........这里部分代码省略.........
示例5: do_request_redirected
useragentObj::response useragentObj::do_request(const fd *terminate_fd,
requestimpl &req,
request_sans_body &impl)
{
bool initial=true;
method_t meth=req.getMethod();
uriimpl redirected_uri;
for (size_t i=0; ; ++i)
{
auto response=initial ?
do_request_redirected(terminate_fd, req, impl)
: ({
requestimpl next(GET, redirected_uri);
request_sans_body no_body;
meth=GET;
do_request_redirected(terminate_fd,
next,
no_body);
});
initial=false;
if (i >= maxredirects.get())
return response; // Too many redirections
LOG_DEBUG("Processing redirect " + to_string(i+1));
// Check for redirects that we should handle
// See RFC 2616.
switch (response->message.getStatusCode()) {
case 301:
case 302:
case 307:
if (meth != HEAD && meth != GET)
return response;
break;
case 303:
break;
default:
return response;
}
// If there's no location header, we cannot redirect
auto location=response->message.equal_range("Location");
if (location.first == location.second)
return response;
try {
redirected_uri=response->uri +
uriimpl(std::string(location.first->
second.begin(),
location.first->
second.end()));
} catch (...) {
// Probably a bad URI
return response;
}
LOG_TRACE("Processing redirect: "
+ std::string(response->begin(), response->end()));
response->discardbody();
}
示例6: LOG_DEBUG
void CommRemote::runThread() {
fd_set sockets;
int maxSocket = serverSocket + 1;
struct timeval timeout;
timeout.tv_sec = (int)floor(socketTimeout);
timeout.tv_usec = (int)floor((socketTimeout - timeout.tv_sec) * 1000);
LOG_DEBUG("Timeouts = %d %d", timeout.tv_sec, timeout.tv_usec);
struct sockaddr_in from;
int fromLength = sizeof(from);
unsigned char clientBuffer[maxPacketSize];
unsigned int offset = 0;
unsigned int size = 0;
FD_ZERO(&sockets);
FD_SET(serverSocket, &sockets);
LOG_TRACE("Starting thread");
threadRunning = true;
while (threadRunning) {
FD_ZERO(&sockets);
FD_SET(serverSocket, &sockets);
if (clientSocket >= 0) {
FD_SET(clientSocket, &sockets);
}
maxSocket = serverSocket > clientSocket ? serverSocket + 1 : clientSocket + 1;
int result = select(maxSocket, &sockets, NULL, NULL, &timeout);
if (result < 0) {
if (errno == EINTR) {
// printf("EINTR caught in select()\n.");
usleep((int)(socketTimeout * 1000000));
continue;
}
LOG_ERROR("Error reading from sockets using select().")
threadRunning = false;
break;
}
// Read data from connected client (if any)
if ((clientSocket >= 0) && FD_ISSET(clientSocket, &sockets)) {
bool closeConnection = false;
// Read as much as we can
int numRead = recv(clientSocket, clientBuffer + offset, maxPacketSize - offset, 0);
if (numRead > 0) {
LOG_INFO("Read %d bytes.", numRead);
}
// Client ended the connection
if (numRead == 0) {
closeConnection = true;
LOG_INFO("Client ended the connection.");
}
// Error reading from the socket
else if ((numRead == -1) && (errno != EAGAIN) && (errno != EINTR)) {
closeConnection = true;
LOG_INFO("Error reading from client socket: %d.", errno);
}
if (closeConnection) {
LOG_INFO("Disconnecting client");
disconnectClient(sockets, maxSocket);
}
// We actually read some data
while (numRead > 0) {
// Do we have a size for the packet?
if ((numRead + offset >= robotMessageHeaderSize) && (size == 0)) {
// We want to read the last 4 bytes (32 bits)
uint32_t *sizePointer = (uint32_t *)(clientBuffer + robotMessageHeaderSize - 4);
size = ntohl(*sizePointer);
LOG_INFO("Read a size of %d", size);
// Update the buffer's offset and numRead counter
offset += robotMessageHeaderSize;
numRead -= robotMessageHeaderSize;
}
// Has the whole packet been read?
if ((size >= 0) && (offset + numRead >= size + robotMessageHeaderSize)) {
// Update the buffer's offset and numRead counter
numRead -= (size + robotMessageHeaderSize - offset);
offset = size + robotMessageHeaderSize; // same as: offset += (size + robotMessageHeaderSize - offset)
LOG_INFO("Received a packet of type %d, size %d.", clientBuffer[0], size);
// Convert it into a packet
// Assumption: the type fits in 1 byte
RemoteMessageToRobot const *message = RemoteMessageToRobot::create(clientBuffer[0],
size,
clientBuffer + robotMessageHeaderSize);
if (message != NULL) {
pthread_mutex_lock(&dataMutex);
messagesToRobot.push_back(message);
//.........这里部分代码省略.........
示例7: usim_api_authenticate
/****************************************************************************
** **
** Name: usim_api_authenticate() **
** **
** Description: Performs mutual authentication of the USIM to the network,**
** checking whether authentication token AUTN can be accep- **
** ted. If so, returns an authentication response RES and **
** the ciphering and integrity keys. **
** In case of synch failure, returns a re-synchronization **
** token AUTS. **
** **
** 3GPP TS 31.102, section 7.1.1.1 **
** **
** Authentication and key generating function algorithms are **
** specified in 3GPP TS 35.206. **
** **
** Inputs: rand_pP: Random challenge number **
** autn_pP: Authentication token **
** AUTN = (SQN xor AK) || AMF || MAC **
** 48 16 64 bits **
** Others: Security key **
** **
** Outputs: auts_pP: Re-synchronization token **
** res_pP: Authentication response **
** ck_pP: Ciphering key **
** ik_pP Integrity key **
** **
** Return: RETURNerror, RETURNok **
** Others: None **
** **
***************************************************************************/
int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP,
OctetString* auts_pP, OctetString* res_pP,
OctetString* ck_pP, OctetString* ik_pP)
{
LOG_FUNC_IN;
int rc;
int i;
LOG_TRACE(DEBUG, "USIM-API - rand :%s",dump_octet_string(rand_pP));
LOG_TRACE(DEBUG, "USIM-API - autn :%s",dump_octet_string(autn_pP));
/* Compute the authentication response RES = f2K (RAND) */
/* Compute the cipher key CK = f3K (RAND) */
/* Compute the integrity key IK = f4K (RAND) */
/* Compute the anonymity key AK = f5K (RAND) */
#define USIM_API_AK_SIZE 6
u8 ak[USIM_API_AK_SIZE];
f2345(_usim_api_k, rand_pP->value,
res_pP->value, ck_pP->value, ik_pP->value, ak);
LOG_TRACE(DEBUG, "USIM-API - res(f2) :%s",dump_octet_string(res_pP));
LOG_TRACE(DEBUG, "USIM-API - ck(f3) :%s",dump_octet_string(ck_pP));
LOG_TRACE(DEBUG, "USIM-API - ik(f4) :%s",dump_octet_string(ik_pP));
LOG_TRACE(DEBUG, "USIM-API - ak(f5) : %02X%02X%02X%02X%02X%02X",
ak[0],ak[1],ak[2],ak[3],ak[4],ak[5]);
/* Retrieve the sequence number SQN = (SQN ⊕ AK) ⊕ AK */
#define USIM_API_SQN_SIZE USIM_API_AK_SIZE
u8 sqn[USIM_API_SQN_SIZE];
for (i = 0; i < USIM_API_SQN_SIZE; i++) {
sqn[i] = autn_pP->value[i] ^ ak[i];
}
LOG_TRACE(DEBUG, "USIM-API - Retrieved SQN %02X%02X%02X%02X%02X%02X",
sqn[0],sqn[1],sqn[2],sqn[3],sqn[4],sqn[5]);
/* Compute XMAC = f1K (SQN || RAND || AMF) */
#define USIM_API_XMAC_SIZE 8
u8 xmac[USIM_API_XMAC_SIZE];
f1(_usim_api_k, rand_pP->value, sqn, &autn_pP->value[USIM_API_SQN_SIZE], xmac);
LOG_TRACE(DEBUG,
"USIM-API - Computed XMAC %02X%02X%02X%02X%02X%02X%02X%02X",
xmac[0],xmac[1],xmac[2],xmac[3],
xmac[4],xmac[5],xmac[6],xmac[7]);
/* Compare the XMAC with the MAC included in AUTN */
#define USIM_API_AMF_SIZE 2
if ( memcmp(xmac, &autn_pP->value[USIM_API_SQN_SIZE + USIM_API_AMF_SIZE],
USIM_API_XMAC_SIZE) != 0 ) {
LOG_TRACE(INFO,
"USIM-API - Comparing the XMAC with the MAC included in AUTN Failed");
//LOG_FUNC_RETURN (RETURNerror);
} else {
LOG_TRACE(INFO,
"USIM-API - Comparing the XMAC with the MAC included in AUTN Succeeded");
}
/* Verify that the received sequence number SQN is in the correct range */
rc = _usim_api_check_sqn(*(uint32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]);
if (rc != RETURNok) {
/* Synchronisation failure; compute the AUTS parameter */
/* Concealed value of the counter SQNms in the USIM:
* Conc(SQNMS) = SQNMS ⊕ f5*K(RAND) */
f5star(_usim_api_k, rand_pP->value, ak);
//.........这里部分代码省略.........
示例8: ipapwd_CheckPolicy
/* check password strenght and history */
int ipapwd_CheckPolicy(struct ipapwd_data *data)
{
struct ipapwd_policy pol = {0};
struct ipapwd_policy tmppol = {0};
time_t acct_expiration;
time_t pwd_expiration;
time_t last_pwd_change;
char **pwd_history;
char *tmpstr;
int ret;
pol.max_pwd_life = IPAPWD_DEFAULT_PWDLIFE;
pol.min_pwd_length = IPAPWD_DEFAULT_MINLEN;
switch(data->changetype) {
case IPA_CHANGETYPE_NORMAL:
/* Find the entry with the password policy */
ret = ipapwd_getPolicy(data->dn, data->target, &pol);
if (ret) {
LOG_TRACE("No password policy, use defaults");
}
break;
case IPA_CHANGETYPE_ADMIN:
/* The expiration date needs to be older than the current time
* otherwise the KDC may not immediately register the password
* as expired. The last password change needs to match the
* password expiration otherwise minlife issues will arise.
*/
data->timeNow -= 1;
data->expireTime = data->timeNow;
/* let set the entry password property according to its
* entry password policy (done with ipapwd_getPolicy)
* For this intentional fallthrough here
*/
case IPA_CHANGETYPE_DSMGR:
/* PassSync agents and Directory Manager can administratively
* change the password without expiring it.
*
* Find password policy for the entry to properly set expiration.
* Do not store it in resulting policy to avoid aplying password
* quality checks on administratively set passwords
*/
ret = ipapwd_getPolicy(data->dn, data->target, &tmppol);
if (ret) {
LOG_TRACE("No password policy, use defaults");
} else {
pol.max_pwd_life = tmppol.max_pwd_life;
pol.history_length = tmppol.history_length;
}
break;
default:
LOG_TRACE("Unknown password change type, use defaults");
break;
}
tmpstr = slapi_entry_attr_get_charptr(data->target,
"krbPrincipalExpiration");
acct_expiration = ipapwd_gentime_to_time_t(tmpstr);
slapi_ch_free_string(&tmpstr);
tmpstr = slapi_entry_attr_get_charptr(data->target,
"krbPasswordExpiration");
pwd_expiration = ipapwd_gentime_to_time_t(tmpstr);
slapi_ch_free_string(&tmpstr);
tmpstr = slapi_entry_attr_get_charptr(data->target,
"krbLastPwdChange");
last_pwd_change = ipapwd_gentime_to_time_t(tmpstr);
slapi_ch_free_string(&tmpstr);
pwd_history = slapi_entry_attr_get_charray(data->target,
"passwordHistory");
/* check policy */
ret = ipapwd_check_policy(&pol, data->password,
data->timeNow,
acct_expiration,
pwd_expiration,
last_pwd_change,
pwd_history);
slapi_ch_array_free(pwd_history);
if (data->expireTime == 0) {
if (pol.max_pwd_life > 0) {
/* max_pwd_life = 0 => never expire
* set expire time only when max_pwd_life > 0 */
data->expireTime = data->timeNow + pol.max_pwd_life;
}
}
data->policy = pol;
return ret;
}
示例9: ipapwd_SetPassword
/* Modify the Password attributes of the entry */
int ipapwd_SetPassword(struct ipapwd_krbcfg *krbcfg,
struct ipapwd_data *data, int is_krb)
{
int ret = 0;
Slapi_Mods *smods = NULL;
Slapi_Value **svals = NULL;
Slapi_Value **ntvals = NULL;
Slapi_Value **pwvals = NULL;
char *nt = NULL;
int is_smb = 0;
int is_ipant = 0;
int is_host = 0;
Slapi_Value *sambaSamAccount;
Slapi_Value *ipaNTUserAttrs;
Slapi_Value *ipaHost;
char *errMesg = NULL;
char *modtime = NULL;
LOG_TRACE("=>\n");
sambaSamAccount = slapi_value_new_string("sambaSamAccount");
if (slapi_entry_attr_has_syntax_value(data->target,
"objectClass", sambaSamAccount)) {
is_smb = 1;
}
slapi_value_free(&sambaSamAccount);
ipaNTUserAttrs = slapi_value_new_string("ipaNTUserAttrs");
if (slapi_entry_attr_has_syntax_value(data->target,
"objectClass", ipaNTUserAttrs)) {
is_ipant = 1;
}
slapi_value_free(&ipaNTUserAttrs);
ipaHost = slapi_value_new_string("ipaHost");
if (slapi_entry_attr_has_syntax_value(data->target,
"objectClass", ipaHost)) {
is_host = 1;
}
slapi_value_free(&ipaHost);
ret = ipapwd_gen_hashes(krbcfg, data,
data->password,
is_krb, is_smb, is_ipant,
&svals, &nt, &ntvals, &errMesg);
if (ret) {
goto free_and_return;
}
smods = slapi_mods_new();
if (svals) {
slapi_mods_add_mod_values(smods, LDAP_MOD_REPLACE,
"krbPrincipalKey", svals);
/* krbLastPwdChange is used to tell whether a host entry has a
* keytab so don't set it on hosts.
*/
if (!is_host) {
/* change Last Password Change field with the current date */
ret = ipapwd_setdate(data->target, smods, "krbLastPwdChange",
data->timeNow, false);
if (ret != LDAP_SUCCESS)
goto free_and_return;
/* set Password Expiration date */
ret = ipapwd_setdate(data->target, smods, "krbPasswordExpiration",
data->expireTime, (data->expireTime == 0));
if (ret != LDAP_SUCCESS)
goto free_and_return;
}
}
if (nt && is_smb) {
slapi_mods_add_string(smods, LDAP_MOD_REPLACE,
"sambaNTPassword", nt);
}
if (ntvals && is_ipant) {
slapi_mods_add_mod_values(smods, LDAP_MOD_REPLACE,
"ipaNTHash", ntvals);
}
if (is_smb) {
/* with samba integration we need to also set sambaPwdLastSet or
* samba will decide the user has to change the password again */
if (data->changetype == IPA_CHANGETYPE_ADMIN) {
/* if it is an admin change instead we need to let know to
* samba as well that the use rmust change its password */
modtime = slapi_ch_smprintf("0");
} else {
modtime = slapi_ch_smprintf("%ld", (long)data->timeNow);
}
if (!modtime) {
LOG_FATAL("failed to smprintf string!\n");
ret = LDAP_OPERATIONS_ERROR;
goto free_and_return;
}
slapi_mods_add_string(smods, LDAP_MOD_REPLACE,
//.........这里部分代码省略.........
示例10: ipapwd_getPolicy
int ipapwd_getPolicy(const char *dn,
Slapi_Entry *target,
struct ipapwd_policy *policy)
{
const char *krbPwdPolicyReference;
char *pdn = NULL;
Slapi_PBlock *pb = NULL;
char *attrs[] = { "krbMaxPwdLife", "krbMinPwdLife",
"krbPwdMinDiffChars", "krbPwdMinLength",
"krbPwdHistoryLength", NULL};
Slapi_Entry **es = NULL;
Slapi_Entry *pe = NULL;
int ret, res, scope, i;
int buffer_flags=0;
Slapi_ValueSet* results = NULL;
char *actual_type_name = NULL;
LOG_TRACE("Searching policy for [%s]\n", dn);
pwd_get_values(target, "krbPwdPolicyReference",
&results, &actual_type_name, &buffer_flags);
if (results) {
Slapi_Value *sv;
slapi_valueset_first_value(results, &sv);
krbPwdPolicyReference = slapi_value_get_string(sv);
pdn = slapi_ch_strdup(krbPwdPolicyReference);
} else {
/* Fallback to hardcoded value */
pdn = slapi_ch_smprintf("cn=global_policy,%s", ipa_realm_dn);
}
if (pdn == NULL) {
LOG_OOM();
ret = -1;
goto done;
}
LOG_TRACE("Using policy at [%s]\n", pdn);
scope = LDAP_SCOPE_BASE;
pb = slapi_pblock_new();
slapi_search_internal_set_pb(pb,
pdn, scope,
"(objectClass=krbPwdPolicy)",
attrs, 0,
NULL, /* Controls */
NULL, /* UniqueID */
ipapwd_plugin_id,
0); /* Flags */
/* do search the tree */
ret = slapi_search_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &res);
if (ret == -1 || res != LDAP_SUCCESS) {
LOG_FATAL("Couldn't find policy, err (%d)\n", res ? res : ret);
ret = -1;
goto done;
}
/* get entries */
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &es);
if (!es) {
LOG_TRACE("No entries ?!");
ret = -1;
goto done;
}
/* count entries */
for (i = 0; es[i]; i++) /* count */ ;
/* if there is only one, return that */
if (i == 1) {
pe = es[0];
} else {
LOG_TRACE("Multiple entries from a base search ?!");
ret = -1;
goto done;
}
/* read data out of policy object */
policy->min_pwd_life = slapi_entry_attr_get_int(pe, "krbMinPwdLife");
policy->max_pwd_life = slapi_entry_attr_get_int(pe, "krbMaxPwdLife");
policy->min_pwd_length = slapi_entry_attr_get_int(pe, "krbPwdMinLength");
policy->history_length = slapi_entry_attr_get_int(pe,
"krbPwdHistoryLength");
policy->min_complexity = slapi_entry_attr_get_int(pe,
"krbPwdMinDiffChars");
ret = 0;
done:
if (results) {
pwd_values_free(&results, &actual_type_name, buffer_flags);
}
if (pb) {
slapi_free_search_results_internal(pb);
slapi_pblock_destroy(pb);
}
//.........这里部分代码省略.........
示例11: ipapwd_gen_checks
int ipapwd_gen_checks(Slapi_PBlock *pb, char **errMesg,
struct ipapwd_krbcfg **config, int check_flags)
{
int ret, ssf;
int rc = LDAP_SUCCESS;
Slapi_Backend *be;
const Slapi_DN *psdn;
Slapi_DN *sdn;
char *dn = NULL;
LOG_TRACE("=>\n");
#ifdef LDAP_EXTOP_PASSMOD_CONN_SECURE
if (check_flags & IPAPWD_CHECK_CONN_SECURE) {
/* Allow password modify on all connections with a Security Strength
* Factor (SSF) higher than 1 */
if (slapi_pblock_get(pb, SLAPI_OPERATION_SSF, &ssf) != 0) {
LOG("Could not get SSF from connection\n");
*errMesg = "Operation requires a secure connection.\n";
rc = LDAP_OPERATIONS_ERROR;
goto done;
}
if (ssf <= 1) {
*errMesg = "Operation requires a secure connection.\n";
rc = LDAP_CONFIDENTIALITY_REQUIRED;
goto done;
}
}
#endif
if (check_flags & IPAPWD_CHECK_DN) {
/* check we have a valid DN in the pblock or just abort */
ret = slapi_pblock_get(pb, SLAPI_TARGET_DN, &dn);
if (ret) {
LOG("Tried to change password for an invalid DN [%s]\n",
dn ? dn : "<NULL>");
*errMesg = "Invalid DN";
rc = LDAP_OPERATIONS_ERROR;
goto done;
}
sdn = slapi_sdn_new_dn_byref(dn);
if (!sdn) {
LOG_FATAL("Unable to convert dn to sdn %s", dn ? dn : "<NULL>");
*errMesg = "Internal Error";
rc = LDAP_OPERATIONS_ERROR;
goto done;
}
be = slapi_be_select(sdn);
slapi_sdn_free(&sdn);
psdn = slapi_be_getsuffix(be, 0);
if (!psdn) {
*errMesg = "Invalid DN";
rc = LDAP_OPERATIONS_ERROR;
goto done;
}
}
/* get the kerberos context and master key */
*config = ipapwd_getConfig();
if (NULL == *config) {
LOG_FATAL("Error Retrieving Master Key");
*errMesg = "Fatal Internal Error";
rc = LDAP_OPERATIONS_ERROR;
}
done:
return rc;
}
示例12: LOG_TRACE
void gcm::TetrFirstOrderInterpolator::interpolate(CalcNode& node, CalcNode& node0, CalcNode& node1, CalcNode& node2, CalcNode& node3)
{
LOG_TRACE("Start interpolation");
float Vol = tetrVolume(
(node1.coords[0])-(node0.coords[0]),
(node1.coords[1])-(node0.coords[1]),
(node1.coords[2])-(node0.coords[2]),
(node2.coords[0])-(node0.coords[0]),
(node2.coords[1])-(node0.coords[1]),
(node2.coords[2])-(node0.coords[2]),
(node3.coords[0])-(node0.coords[0]),
(node3.coords[1])-(node0.coords[1]),
(node3.coords[2])-(node0.coords[2])
);
float factor[4];
factor[0] = fabs(tetrVolume(
(node1.coords[0])-(node.coords[0]),
(node1.coords[1])-(node.coords[1]),
(node1.coords[2])-(node.coords[2]),
(node2.coords[0])-(node.coords[0]),
(node2.coords[1])-(node.coords[1]),
(node2.coords[2])-(node.coords[2]),
(node3.coords[0])-(node.coords[0]),
(node3.coords[1])-(node.coords[1]),
(node3.coords[2])-(node.coords[2])
) / Vol);
factor[1] = fabs(tetrVolume(
(node0.coords[0])-(node.coords[0]),
(node0.coords[1])-(node.coords[1]),
(node0.coords[2])-(node.coords[2]),
(node2.coords[0])-(node.coords[0]),
(node2.coords[1])-(node.coords[1]),
(node2.coords[2])-(node.coords[2]),
(node3.coords[0])-(node.coords[0]),
(node3.coords[1])-(node.coords[1]),
(node3.coords[2])-(node.coords[2])
) / Vol);
factor[2] = fabs(tetrVolume(
(node1.coords[0])-(node.coords[0]),
(node1.coords[1])-(node.coords[1]),
(node1.coords[2])-(node.coords[2]),
(node0.coords[0])-(node.coords[0]),
(node0.coords[1])-(node.coords[1]),
(node0.coords[2])-(node.coords[2]),
(node3.coords[0])-(node.coords[0]),
(node3.coords[1])-(node.coords[1]),
(node3.coords[2])-(node.coords[2])
) / Vol);
factor[3] = fabs(tetrVolume(
(node1.coords[0])-(node.coords[0]),
(node1.coords[1])-(node.coords[1]),
(node1.coords[2])-(node.coords[2]),
(node2.coords[0])-(node.coords[0]),
(node2.coords[1])-(node.coords[1]),
(node2.coords[2])-(node.coords[2]),
(node0.coords[0])-(node.coords[0]),
(node0.coords[1])-(node.coords[1]),
(node0.coords[2])-(node.coords[2])
) / Vol);
// If we see potential instability
if (factor[0] + factor[1] + factor[2] + factor[3] > 1.0) {
// If it is small - treat instability as minor and just 'smooth' it
// TODO - think about it more carefully
//if( point_in_tetr(node.local_num, node.coords[0], node.coords[1], node.coords[2], tetr) )
if (factor[0] + factor[1] + factor[2] + factor[3] < 10) // [email protected]
{
if (factor[0] + factor[1] + factor[2] + factor[3] > 5.0)
LOG_ERROR("Factor: " << factor[0] + factor[1] + factor[2] + factor[3]);
float sum = factor[0] + factor[1] + factor[2] + factor[3];
for (int i = 0; i < 4; i++)
factor[i] = factor[i] / sum;
}
// If point is not in tetr - throw exception
else {
/* *logger << "\tTetrVol = " < Vol;
*logger << "\tfactor[0]=" << factor[0] << " factor[1]=" << factor[1] << " factor[2]=" << factor[2] << " factor[3]=" << factor[3] << " Sum: " < factor[0] + factor[1] + factor[2] + factor[3];
*logger << "\tnode.x[0]=" << node.coords[0] << " node.x[1]=" << node.coords[1]
<< " node.x[2]=" < node.coords[2];
if( node.isFirstOrder() )
*logger < "First order node";
else if( node.isSecondOrder() )
*logger < "Second order node";
*logger << "\tv0.x[0]=" << nodes[tetr.vert[0]].coords[0] << " v0.x[1]=" << nodes[tetr.vert[0]].coords[1] << " v0.x[2]=" < nodes[tetr.vert[0]].coords[2];
*logger << "\tv1.x[0]=" << nodes[tetr.vert[1]].coords[0] << " v1.x[1]=" << nodes[tetr.vert[1]].coords[1] << " v1.x[2]=" < nodes[tetr.vert[1]].coords[2];
*logger << "\tv2.x[0]=" << nodes[tetr.vert[2]].coords[0] << " v2.x[1]=" << nodes[tetr.vert[2]].coords[1] << " v2.x[2]=" < nodes[tetr.vert[2]].coords[2];
*logger << "\tv3.x[0]=" << nodes[tetr.vert[3]].coords[0] << " v3.x[1]=" << nodes[tetr.vert[3]].coords[1] << " v3.x[2]=" < nodes[tetr.vert[3]].coords[2];*/
LOG_ERROR("Requested node: " << node);
LOG_ERROR("Node #1: " << node0);
//.........这里部分代码省略.........
示例13: GetRawNode
/**
* @brief Creates logical tile from tile group and applies scan predicate.
* @return true on success, false otherwise.
*/
bool SeqScanExecutor::DExecute() {
// Scanning over a logical tile.
if (children_.size() == 1 &&
// There will be a child node on the create index scenario,
// but we don't want to use this execution flow
!(GetRawNode()->GetChildren().size() > 0 &&
GetRawNode()->GetChildren()[0].get()->GetPlanNodeType() ==
PlanNodeType::CREATE &&
((planner::CreatePlan *)GetRawNode()->GetChildren()[0].get())
->GetCreateType() == CreateType::INDEX)) {
// FIXME Check all requirements for children_.size() == 0 case.
LOG_TRACE("Seq Scan executor :: 1 child ");
PELOTON_ASSERT(target_table_ == nullptr);
PELOTON_ASSERT(column_ids_.size() == 0);
while (children_[0]->Execute()) {
std::unique_ptr<LogicalTile> tile(children_[0]->GetOutput());
if (predicate_ != nullptr) {
// Invalidate tuples that don't satisfy the predicate.
for (oid_t tuple_id : *tile) {
ContainerTuple<LogicalTile> tuple(tile.get(), tuple_id);
auto eval = predicate_->Evaluate(&tuple, nullptr, executor_context_);
if (eval.IsFalse()) {
// if (predicate_->Evaluate(&tuple, nullptr, executor_context_)
// .IsFalse()) {
tile->RemoveVisibility(tuple_id);
}
}
}
if (0 == tile->GetTupleCount()) { // Avoid returning empty tiles
continue;
}
/* Hopefully we needn't do projections here */
SetOutput(tile.release());
return true;
}
return false;
}
// Scanning a table
else if (children_.size() == 0 ||
// If we are creating an index, there will be a child
(children_.size() == 1 &&
// This check is only needed to pass seq_scan_test
// unless it is possible to add a executor child
// without a corresponding plan.
GetRawNode()->GetChildren().size() > 0 &&
// Check if the plan is what we actually expect.
GetRawNode()->GetChildren()[0].get()->GetPlanNodeType() ==
PlanNodeType::CREATE &&
// If it is, confirm it is for indexes
((planner::CreatePlan *)GetRawNode()->GetChildren()[0].get())
->GetCreateType() == CreateType::INDEX)) {
LOG_TRACE("Seq Scan executor :: 0 child ");
PELOTON_ASSERT(target_table_ != nullptr);
PELOTON_ASSERT(column_ids_.size() > 0);
if (children_.size() > 0 && !index_done_) {
children_[0]->Execute();
// This stops continuous executions due to
// a parent and avoids multiple creations
// of the same index.
index_done_ = true;
}
concurrency::TransactionManager &transaction_manager =
concurrency::TransactionManagerFactory::GetInstance();
bool acquire_owner = GetPlanNode<planner::AbstractScan>().IsForUpdate();
auto current_txn = executor_context_->GetTransaction();
// Retrieve next tile group.
while (current_tile_group_offset_ < table_tile_group_count_) {
auto tile_group =
target_table_->GetTileGroup(current_tile_group_offset_++);
auto tile_group_header = tile_group->GetHeader();
oid_t active_tuple_count = tile_group->GetNextTupleSlot();
// Construct position list by looping through tile group
// and applying the predicate.
std::vector<oid_t> position_list;
for (oid_t tuple_id = 0; tuple_id < active_tuple_count; tuple_id++) {
ItemPointer location(tile_group->GetTileGroupId(), tuple_id);
auto visibility = transaction_manager.IsVisible(
current_txn, tile_group_header, tuple_id);
// check transaction visibility
if (visibility == VisibilityType::OK) {
// if the tuple is visible, then perform predicate evaluation.
if (predicate_ == nullptr) {
//.........这里部分代码省略.........
示例14: self
void connection::do_read_head()
{
auto self(shared_from_this());
// bytes_transferred never grater than sizeof(buffer_)
socket_.async_read_some(boost::asio::buffer(buffer_), strand_.wrap(
[this, self](boost::system::error_code ec, std::size_t bytes_transferred)
{
if (!ec)
{
timestamp_ = time(NULL);
total_bytes_received_ += bytes_transferred;
// check http package size
if(total_bytes_received_ > max_http_package_size) {
reply_ = reply::stock_reply(reply::bad_request);
do_write();
LOG_TRACE("too long http request from client: %s:u", this->get_address(), port_);
return;
}
request_parser::result_type result;
std::tie(result, std::ignore) = request_parser_.parse(
request_, buffer_.data(), buffer_.data() + bytes_transferred);
// check header
switch(result) {
case request_parser::good: // read header complete
if(0 == stricmp(request_.method.c_str(), "POST"))
{ /// head read complete
// LOG_TRACE_ALL("header length:%d, content length:%d", request_.header_length, request_.content_length);
size_t content_bytes = this->total_bytes_received_ - request_.header_length;
if(content_bytes > 0)
{ // put remain data to content
request_.content.append(buffer_.data() + (bytes_transferred - content_bytes), content_bytes);
}
do_check();
}
else if(0 == stricmp(request_.method.c_str(), "GET"))
{
request_handler_.handle_request(request_, reply_);
do_write();
}
else { // do not support other request
reply_ = reply::stock_reply(reply::bad_request);
do_write();
}
break;
case request_parser::bad:
reply_ = reply::stock_reply(reply::bad_request);
do_write();
break;
default: // head insufficient
do_read_head();
}
}
else
{
LOG_TRACE("peer interrupt ahead of time, detail:%s", ec.message().c_str());
connection_manager_.stop(shared_from_this());
/*if(ec != boost::asio::error::operation_aborted)
{
connection_manager_.stop(shared_from_this());
}*/
}
}) );
}
示例15: TRI_CleanupVocBase
void TRI_CleanupVocBase (void* data) {
TRI_vector_pointer_t collections;
uint64_t iterations = 0;
TRI_vocbase_t* vocbase = static_cast<TRI_vocbase_t*>(data);
assert(vocbase);
assert(vocbase->_state == 1);
TRI_InitVectorPointer(&collections, TRI_UNKNOWN_MEM_ZONE);
while (true) {
int state;
// keep initial _state value as vocbase->_state might change during cleanup loop
state = vocbase->_state;
++iterations;
if (state == 2) {
// shadows must be cleaned before collections are handled
// otherwise the shadows might still hold barriers on collections
// and collections cannot be closed properly
CleanupCursors(vocbase, true);
}
// check if we can get the compactor lock exclusively
if (TRI_CheckAndLockCompactorVocBase(vocbase)) {
size_t i, n;
// copy all collections
TRI_READ_LOCK_COLLECTIONS_VOCBASE(vocbase);
TRI_CopyDataVectorPointer(&collections, &vocbase->_collections);
TRI_READ_UNLOCK_COLLECTIONS_VOCBASE(vocbase);
n = collections._length;
for (i = 0; i < n; ++i) {
TRI_vocbase_col_t* collection;
TRI_primary_collection_t* primary;
TRI_document_collection_t* document;
collection = (TRI_vocbase_col_t*) collections._buffer[i];
TRI_READ_LOCK_STATUS_VOCBASE_COL(collection);
primary = collection->_collection;
if (primary == NULL) {
TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection);
continue;
}
TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection);
// we're the only ones that can unload the collection, so using
// the collection pointer outside the lock is ok
// maybe cleanup indexes, unload the collection or some datafiles
document = (TRI_document_collection_t*) primary;
// clean indexes?
if (iterations % (uint64_t) CLEANUP_INDEX_ITERATIONS == 0) {
document->cleanupIndexes(document);
}
CleanupDocumentCollection(document);
}
TRI_UnlockCompactorVocBase(vocbase);
}
if (vocbase->_state >= 1) {
// server is still running, clean up unused shadows
if (iterations % CLEANUP_SHADOW_ITERATIONS == 0) {
CleanupCursors(vocbase, false);
}
// clean up expired compactor locks
TRI_CleanupCompactorVocBase(vocbase);
if (state == 1) {
TRI_LockCondition(&vocbase->_cleanupCondition);
TRI_TimedWaitCondition(&vocbase->_cleanupCondition, (uint64_t) CLEANUP_INTERVAL);
TRI_UnlockCondition(&vocbase->_cleanupCondition);
}
}
if (state == 3) {
// server shutdown
break;
}
}
TRI_DestroyVectorPointer(&collections);
LOG_TRACE("shutting down cleanup thread");
}