// virtual bool LLAssetStorage::deletePendingRequestImpl(LLAssetStorage::request_list_t* requests, LLAssetType::EType asset_type, const LLUUID& asset_id) { LLAssetRequest* req = findRequest(requests, asset_type, asset_id); if (req) { // Remove the request from this list. requests->remove(req); S32 error = LL_ERR_TCP_TIMEOUT; // Run callbacks. if (req->mUpCallback) { req->mUpCallback(req->getUUID(), req->mUserData, error, LL_EXSTAT_REQUEST_DROPPED); } if (req->mDownCallback) { req->mDownCallback(mVFS, req->getUUID(), req->getType(), req->mUserData, error, LL_EXSTAT_REQUEST_DROPPED); } if (req->mInfoCallback) { LLAssetInfo info; req->mInfoCallback(&info, req->mUserData, error); } delete req; return true; } return false; }
void JDnsShared::jdns_error(int id, QJDns::Error e) { QJDns *jdns = (QJDns *)sender(); JDnsSharedRequest *r = findRequest(jdns, id); if(!r) return; // "cancel" it for(int n = 0; n < r->_handles.count(); ++n) { JDnsSharedRequest::Handle &h = r->_handles[n]; if(h.jdns == jdns && h.id == id) { r->_handles.removeAt(n); if(r->_handles.isEmpty()) requests.removeAll(r); break; } } // for queries, ignore the error if it is not the last error if(r->_type == JDnsSharedRequest::Query && !r->_handles.isEmpty()) return; r->_success = false; JDnsSharedRequest::Error x = JDnsSharedRequest::ErrorGeneric; if(e == QJDns::ErrorNXDomain) x = JDnsSharedRequest::ErrorNXDomain; else if(e == QJDns::ErrorTimeout) x = JDnsSharedRequest::ErrorTimeout; else // ErrorGeneric x = JDnsSharedRequest::ErrorGeneric; r->_error = x; emit r->resultsReady(); }
// virtual LLSD LLHTTPAssetStorage::getPendingDetails(LLAssetStorage::ERequestType rt, LLAssetType::EType asset_type, const std::string& detail_prefix) const { LLSD sd = LLAssetStorage::getPendingDetails(rt, asset_type, detail_prefix); const request_list_t* running = getRunningList(rt); if (running) { // Loop through the pending requests sd, and add extra info about its running status. S32 num_pending = sd["requests"].size(); S32 i; for (i = 0; i < num_pending; ++i) { LLSD& pending = sd["requests"][i]; // See if this pending request is running. const LLAssetRequest* req = findRequest(running, LLAssetType::lookup(pending["type"].asString().c_str()), pending["asset_id"]); if (req) { // Keep the detail_url so we don't have to rebuild it. LLURI detail_url = pending["detail"]; pending = req->getTerseDetails(); pending["detail"] = detail_url; pending["is_running"] = true; } else { pending["is_running"] = false; } } } return sd; }
void JDnsShared::jdns_resultsReady(int id, const QJDns::Response &results) { QJDns *jdns = (QJDns *)sender(); JDnsSharedRequest *r = findRequest(jdns, id); if(!r) return; r->_success = true; r->_results.clear(); for(int n = 0; n < results.answerRecords.count(); ++n) r->_results += results.answerRecords[n]; if(mode == UnicastInternet || mode == UnicastLocal) { // only one response, so "cancel" it for(int n = 0; n < r->_handles.count(); ++n) { JDnsSharedRequest::Handle &h = r->_handles[n]; if(h.jdns == jdns && h.id == id) { r->_handles.removeAt(n); if(r->_handles.isEmpty()) requests.removeAll(r); break; } } } emit r->resultsReady(); }
// virtual bool LLHTTPAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt, LLAssetType::EType asset_type, const LLUUID& asset_id) { // Try removing this from the running list first. request_list_t* running = getRunningList(rt); if (running) { LLAssetRequest* req = findRequest(running, asset_type, asset_id); if (req) { // Remove this request from the running list to get it out of curl. running->remove(req); // Find this request in the pending list, so we can move it to the end of the line. request_list_t* pending = getRequestList(rt); if (pending) { request_list_t::iterator result = std::find_if(pending->begin(), pending->end(), std::bind2nd(ll_asset_request_equal<LLAssetRequest*>(), req)); if (pending->end() != result) { // This request was found in the pending list. Move it to the end! LLAssetRequest* pending_req = *result; pending->remove(pending_req); if (!pending_req->mIsUserWaiting) //A user is waiting on this request. Toss it. { pending->push_back(pending_req); } else { if (pending_req->mUpCallback) //Clean up here rather than _callUploadCallbacks because this request is already cleared the req. { pending_req->mUpCallback(pending_req->getUUID(), pending_req->mUserData, -1, LL_EXSTAT_REQUEST_DROPPED); } } llinfos << "Asset " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) << " removed from curl and placed at the end of the pending queue." << llendl; } else { llwarns << "Unable to find pending " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) << llendl; } } delete req; return true; } } return LLAssetStorage::deletePendingRequest(rt, asset_type, asset_id); }
void JDnsShared::jdns_published(int id) { QJDns *jdns = (QJDns *)sender(); JDnsSharedRequest *r = findRequest(jdns, id); if(!r) return; r->_success = true; emit r->resultsReady(); }
// virtual LLSD LLAssetStorage::getPendingRequestImpl(const LLAssetStorage::request_list_t* requests, LLAssetType::EType asset_type, const LLUUID& asset_id) const { LLSD sd; const LLAssetRequest* req = findRequest(requests, asset_type, asset_id); if (req) { sd = req->getFullDetails(); } return sd; }
/*! This slot is for receiving signals from a QTransportAuth object alerting the presence of an incoming message for authentication against policy. The QTransportAuth should already have taken care of confirming the identity of message originator, and validity of the message transport. Note that any number of authorisers can connect to this slot. If any one of them sets the permit Status bits to Deny, then the request will be denied regardless of other authorisers. In other words all must either provide Allow status (or leave the status unchanged) for the request to pass. The QTransportAuth::Data item \a d is the connection data representing the source of the \a req. */ void SXEPolicyManager::policyCheck( QTransportAuth::Data &d, const QString &req ) { QString request = req; #ifndef SXE_INSTALLER qLog(SXE) << "Policy Check program" << d.progId << ", pid" << d.processId << "- status " << QTransportAuth::errorString( d ) << " - request" << ( request.isEmpty() ? "empty" : request ); #endif if ( request.isEmpty() ) return; // nothing to do if ( request.endsWith("_fragment_") ) request.chop( 10 );//size of "_fragment_" #ifdef PERMISSIVE if ( d.status == QTransportAuth::Allow ) return; #else if ( d.status == QTransportAuth::Deny ) return; #endif QStringList profiles = findPolicy( d.progId ); qLog(SXE) << "\tprofiles awarded to program" << d.progId << "are" << profiles; QString foundIn = findRequest( request, profiles ); if ( foundIn.isEmpty() ) { // the request was not found at all in the searched policies qLog(SXE) << "\trequest" << request << "not found in above profiles"; d.status = ( d.status & QTransportAuth::ErrMask ) | QTransportAuth::Deny; } else if ( foundIn == QLatin1String("deny") ) { // the request was blacklisted qLog(SXE) << "\trequest" << request << "blacklisted"; d.status = ( d.status & QTransportAuth::ErrMask ) | QTransportAuth::Deny; } else if ( foundIn == QLatin1String("allow") ) { // the request was whitelisted qLog(SXE) << "\trequest" << request << "whitelisted"; d.status = ( d.status & QTransportAuth::ErrMask ) | QTransportAuth::Allow; } else if ( profiles.contains( foundIn )) { qLog(SXE) << "\trequest" << request << "found in above profiles"; d.status = ( d.status & QTransportAuth::ErrMask ) | QTransportAuth::Allow; } else { qLog(SXE) << "\trequest" << request << "found in domain not awarded:" << foundIn; d.status = ( d.status & QTransportAuth::ErrMask ) | QTransportAuth::Deny; } }
//! \brief Adds a new draw request to the render layer //! \param drawRequest [in] - //! The DrawRequest instance to be added to this layer. //! \return <em>True</em> if the request was added successfully otherwise <em>false</em>. bool RenderLayer::addRequest( const DrawRequest &drawRequest ) { assert( nullptr != drawRequest.material ); MaterialRequest *request = findRequest( drawRequest.material ); if ( nullptr == request ) { // TODO: Allocate request return false; } /* if ( request->add( drawRequest ) ) { m_requestCount++; return true; } */ return false; }
static CONDITION serviceThisCommand(DUL_NETWORKKEY ** network, DUL_ASSOCIATIONKEY ** association, DUL_PRESENTATIONCONTEXT * ctx, MSG_TYPE messageType, void **message, DUL_ASSOCIATESERVICEPARAMETERS * params, DMAN_HANDLE ** handle) { CONDITION cond; MSG_GENERAL * general; general = *(MSG_GENERAL **) message; if (!silent) MSG_DumpMessage((void *) general, stdout); switch (messageType) { case MSG_K_C_ECHO_REQ: cond = echoRequest(association, ctx, (MSG_C_ECHO_REQ **) message); break; case MSG_K_C_STORE_REQ: cond = storeRequest(params, association, handle, ctx, (MSG_C_STORE_REQ **) message); break; case MSG_K_C_FIND_REQ: cond = findRequest(association, params, ctx, (MSG_C_FIND_REQ **) message, &IDBHandle); break; case MSG_K_C_MOVE_REQ: cond = moveRequest(network, association, ctx, (MSG_C_MOVE_REQ **) message, params, &IDBHandle, handle); break; case MSG_K_C_GET_REQ: cond = cgetRequest(network, association, ctx, (MSG_C_GET_REQ **) message, params, &IDBHandle, handle); break; case MSG_K_C_CANCEL_REQ: cond = SRV_NORMAL; /* This must have happened after we were done */ break; default: fprintf(stderr, "Unimplemented message type: %d\n", messageType); cond = 1; break; } return cond; }
// virtual bool LLHTTPAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt, LLAssetType::EType asset_type, const LLUUID& asset_id) { // Try removing this from the running list first. request_list_t* running = getRunningList(rt); if (running) { LLAssetRequest* req = findRequest(running, asset_type, asset_id); if (req) { // Remove this request from the running list to get it out of curl. running->remove(req); // Find this request in the pending list, so we can move it to the end of the line. request_list_t* pending = getRequestList(rt); if (pending) { request_list_t::iterator result = std::find_if(pending->begin(), pending->end(), std::bind2nd(ll_asset_request_equal<LLAssetRequest*>(), req)); if (pending->end() != result) { // This request was found in the pending list. Move it to the end! LLAssetRequest* pending_req = *result; pending->remove(pending_req); pending->push_back(pending_req); llinfos << "Asset " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) << " removed from curl and placed at the end of the pending queue." << llendl; } else { llwarns << "Unable to find pending " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) << llendl; } } delete req; return true; } } return LLAssetStorage::deletePendingRequest(rt, asset_type, asset_id); }
void recvReadReply(trfs_pkt_t *rq) { trfs_fio_t *fio = &(rq->readReply.info); void *data = rq->readReply.data; SHOW_FLOW( 2, "read reply for fid %d ioid %d nSect %d start %ld", fio->fileId, fio->ioId, fio->nSectors, fio->startSector); trfs_queue_t *qe = findRequest( fio, TRFS_QEL_TYPE_READ ); if( qe == 0 ) { SHOW_ERROR0( 0, "TRFS: No request for read reply"); return; } trfs_process_received_data(qe, fio, data); trfs_mark_recombine_map(qe, fio->startSector, fio->nSectors); if( trfs_request_complete(qe) ) { removeRequest(qe); trfs_signal_done(qe); } }