当前位置: 首页>>代码示例>>C++>>正文


C++ Request类代码示例

本文整理汇总了C++中Request的典型用法代码示例。如果您正苦于以下问题:C++ Request类的具体用法?C++ Request怎么用?C++ Request使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Request类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: nss

void Strategy::getMore(OperationContext* txn, Request& request) {
    Timer getMoreTimer;

    const char* ns = request.getns();
    const int ntoreturn = request.d().pullInt();
    const long long id = request.d().pullInt64();

    // TODO:  Handle stale config exceptions here from coll being dropped or sharded during op
    // for now has same semantics as legacy request
    const NamespaceString nss(ns);
    auto statusGetDb = grid.catalogCache()->getDatabase(txn, nss.db().toString());
    if (statusGetDb == ErrorCodes::DatabaseNotFound) {
        cursorCache.remove(id);
        replyToQuery(ResultFlag_CursorNotFound, request.p(), request.m(), 0, 0, 0);
        return;
    }

    uassertStatusOK(statusGetDb);

    // Spigot which controls whether OP_QUERY style find on mongos uses the new ClusterClientCursor
    // code path.
    //
    // TODO: Delete the spigot and always use the new code.
    if (useClusterClientCursor) {
        boost::optional<long long> batchSize;
        if (ntoreturn) {
            batchSize = ntoreturn;
        }
        GetMoreRequest getMoreRequest(NamespaceString(ns), id, batchSize, boost::none);

        auto cursorResponse = ClusterFind::runGetMore(txn, getMoreRequest);
        if (cursorResponse == ErrorCodes::CursorNotFound) {
            replyToQuery(ResultFlag_CursorNotFound, request.p(), request.m(), 0, 0, 0);
            return;
        }
        uassertStatusOK(cursorResponse.getStatus());

        // Build the response document.
        //
        // TODO: this constant should be shared between mongos and mongod, and should not be inside
        // ShardedClientCursor.
        BufBuilder buffer(ShardedClientCursor::INIT_REPLY_BUFFER_SIZE);

        int numResults = 0;
        for (const auto& obj : cursorResponse.getValue().batch) {
            buffer.appendBuf((void*)obj.objdata(), obj.objsize());
            ++numResults;
        }

        replyToQuery(0,
                     request.p(),
                     request.m(),
                     buffer.buf(),
                     buffer.len(),
                     numResults,
                     cursorResponse.getValue().numReturnedSoFar.value_or(0),
                     cursorResponse.getValue().cursorId);
        return;
    }

    shared_ptr<DBConfig> config = statusGetDb.getValue();

    ShardPtr primary;
    ChunkManagerPtr info;
    config->getChunkManagerOrPrimary(txn, ns, info, primary);

    //
    // TODO: Cleanup cursor cache, consolidate into single codepath
    //
    const string host = cursorCache.getRef(id);
    ShardedClientCursorPtr cursor = cursorCache.get(id);
    int cursorMaxTimeMS = cursorCache.getMaxTimeMS(id);

    // Cursor ids should not overlap between sharded and unsharded cursors
    massert(17012,
            str::stream() << "duplicate sharded and unsharded cursor id " << id << " detected for "
                          << ns << ", duplicated on host " << host,
            NULL == cursorCache.get(id).get() || host.empty());

    ClientBasic* client = ClientBasic::getCurrent();
    NamespaceString nsString(ns);
    AuthorizationSession* authSession = AuthorizationSession::get(client);
    Status status = authSession->checkAuthForGetMore(nsString, id, false);
    audit::logGetMoreAuthzCheck(client, nsString, id, status.code());
    uassertStatusOK(status);

    if (!host.empty()) {
        LOG(3) << "single getmore: " << ns;

        // we used ScopedDbConnection because we don't get about config versions
        // not deleting data is handled elsewhere
        // and we don't want to call setShardVersion
        ScopedDbConnection conn(host);

        Message response;
        bool ok = conn->callRead(request.m(), response);
        uassert(10204, "dbgrid: getmore: error calling db", ok);

        bool hasMore = (response.singleData().getCursor() != 0);

//.........这里部分代码省略.........
开发者ID:hyrlamiranda,项目名称:mongo,代码行数:101,代码来源:strategy.cpp

示例2: _update

        void _update( Request& r , DbMessage& d, ChunkManagerPtr manager ){
            int flags = d.pullInt();
            
            BSONObj query = d.nextJsObj();
            uassert( 10201 ,  "invalid update" , d.moreJSObjs() );
            BSONObj toupdate = d.nextJsObj();

            BSONObj chunkFinder = query;
            
            bool upsert = flags & UpdateOption_Upsert;
            bool multi = flags & UpdateOption_Multi;

            uassert( 10202 ,  "can't mix multi and upsert and sharding" , ! ( upsert && multi ) );

            if ( upsert && !(manager->hasShardKey(toupdate) ||
                             (toupdate.firstElement().fieldName()[0] == '$' && manager->hasShardKey(query))))
            {
                throw UserException( 8012 , "can't upsert something without shard key" );
            }

            bool save = false;
            if ( ! manager->hasShardKey( query ) ){
                if ( multi ){
                }
                else if ( strcmp( query.firstElement().fieldName() , "_id" ) || query.nFields() != 1 ){
                    throw UserException( 8013 , "can't do non-multi update with query that doesn't have the shard key" );
                }
                else {
                    save = true;
                    chunkFinder = toupdate;
                }
            }

            
            if ( ! save ){
                if ( toupdate.firstElement().fieldName()[0] == '$' ){
                    BSONObjIterator ops(toupdate);
                    while(ops.more()){
                        BSONElement op(ops.next());
                        if (op.type() != Object)
                            continue;
                        BSONObjIterator fields(op.embeddedObject());
                        while(fields.more()){
                            const string field = fields.next().fieldName();
                            uassert(13123, "Can't modify shard key's value", ! manager->getShardKey().partOfShardKey(field));
                        }
                    }
                } else if ( manager->hasShardKey( toupdate ) ){
                    uassert( 8014, "change would move shards!", manager->getShardKey().compare( query , toupdate ) == 0 );
                } else {
                    uasserted(12376, "shard key must be in update object");
                }
            }
            
            if ( multi ){
                set<Shard> shards;
                manager->getShardsForQuery( shards , chunkFinder );
                int * x = (int*)(r.d().afterNS());
                x[0] |= UpdateOption_Broadcast;
                for ( set<Shard>::iterator i=shards.begin(); i!=shards.end(); i++){
                    doWrite( dbUpdate , r , *i , false );
                }
            }
            else {
                int left = 5;
                while ( true ){
                    try {
                        ChunkPtr c = manager->findChunk( chunkFinder );
                        doWrite( dbUpdate , r , c->getShard() );
                        c->splitIfShould( d.msg().header()->dataLen() );
                        break;
                    }
                    catch ( StaleConfigException& e ){
                        if ( left <= 0 )
                            throw e;
                        left--;
                        log() << "update failed b/c of StaleConfigException, retrying " 
                              << " left:" << left << " ns: " << r.getns() << " query: " << query << endl;
                        r.reset( false );
                        manager = r.getChunkManager();
                    }
                }
            }

        }
开发者ID:kapouer,项目名称:mongo-debian,代码行数:85,代码来源:strategy_shard.cpp

示例3: requestData

int TcpClient::requestData(const int nSeq, const int nMsgId, const string& arg, NetworkProxy *pData)
{
	TopMessage msgrep;
	msgrep.set_protocol_version("1.0");
	msgrep.set_msg_type(REQUEST);
	msgrep.set_sub_msg_type(POST);
	msgrep.set_session_id(G.m_strSessionID);
	msgrep.set_seq(nSeq);
	msgrep.set_host(m_strIP);
	msgrep.set_user_name(G.m_strUserName);
	msgrep.set_version((float)NT_VERSION);
	
	Request req;
	req.set_domid(G.m_nDomID);
	req.set_msgid(nMsgId);
	req.set_arg(arg);

	int datalen = req.ByteSize();
	char *buf = new char[datalen];
	autoptr_arr<char> arrguard1(buf);
	if (!req.SerializeToArray(buf, datalen))
	{
		//closeAndReConn();
		return 1;
	}

	msgrep.set_data(buf, datalen);

	datalen = msgrep.ByteSize();
	int headlen = CodedOutputStream::VarintSize32(datalen);

	char *databuf = new char[datalen];
	autoptr_arr<char> arrguard(databuf);
	if (!msgrep.SerializeToArray(databuf, datalen))
	{
		//closeAndReConn();
		return 1;
	}

	//char *tmpArr = new char[datalen+headlen];
	//autoptr_arr<char> arrguard2(tmpArr);
	
	lock_guard<mutex> lg(m_writeMutex);
	if (m_writeData.expand(datalen+headlen))
	{
		ZeroCopyOutputStream* raw_output = new ArrayOutputStream(m_writeData.getBuf() + m_writeData.getPos(), datalen+headlen);
		CodedOutputStream* coded_output = new CodedOutputStream(raw_output);
		coded_output->WriteVarint32(datalen);
		coded_output->WriteRaw(databuf, datalen);
		m_writeData.setPos(m_writeData.getPos() + (datalen+headlen));

		ReserveData *pReserveData = new ReserveData;
		pReserveData->pNetworkProxy = pData;
		pReserveData->nReqID = nMsgId;
		G.m_mapReserveData.insert(map<int, ReserveData*>::value_type(nSeq, pReserveData));
		G.m_setReqSource.insert(pData);
		m_writeCv.notify_one();

		delete coded_output;
		delete raw_output;	
	}

	return 0;
}
开发者ID:yangyong3108,项目名称:project-001,代码行数:64,代码来源:TcpClient.cpp

示例4: loadFavourites

void ZatData::loadChannels() {


    Json::Value favs = loadFavourites();

    ostringstream urlStream;
    urlStream << "zattoo.com/zapi/v2/cached/channels/" << powerHash << "?details=False";

    HTTPSocketRaw *socket = new HTTPSocketRaw();
    Request request;
    request.url = urlStream.str();
    request.AddHeader("Cookie", cookie);
    Response response;
    socket->Execute(request, response);
    cookie = response.cookie;
    std::string jsonString = response.body;

    Json::Value json;
    Json::Reader reader;
    
    if (!reader.parse(jsonString,json)){
        // report to the user the failure and their locations in the document.
        std::cout  << "Failed to parse configuration\n"
        << reader.getFormatedErrorMessages();
        return;
    }

    channelNumber = 1;
    Json::Value groups = json["channel_groups"];

    PVRZattooChannelGroup favGroup;
    favGroup.name = "Favoriten";
    //Load the channel groups and channels
    for ( int index = 0; index < groups.size(); ++index ) {
        PVRZattooChannelGroup group;
        group.name = groups[index]["name"].asString();
        Json::Value channels = groups[index]["channels"];
        for(int i = 0; i < channels.size(); ++i) {
            Json::Value qualities = channels[i]["qualities"];
            for(int q = 0; q < qualities.size(); ++q) {
                if(qualities[q]["availability"].asString() == "available") {
                    ZatChannel channel;
                    channel.name = qualities[q]["title"].asString();
                    channel.strStreamURL = "";
                    //cout << channel.name << endl;
                    std::string cid = channels[i]["cid"].asString(); //returns std::size_t
                    channel.iUniqueId = GetChannelId(cid.c_str());
                    channel.cid = cid;
                    channel.iChannelNumber = ++channelNumber;
                    channel.strLogoPath = "http://logos.zattic.com";
                    channel.strLogoPath.append(qualities[q]["logo_white_84"].asString());
                    group.channels.insert(group.channels.end(), channel);
                    //Yeah thats bad performance
                    for (int fav = 0; fav < favs.size(); fav++) {
                        if (favs[fav].asString() == cid) {
                            favGroup.channels.insert(favGroup.channels.end(), channel);
                        }
                    }
                    break;
                }   
            }
        }
        if (group.channels.size() > 0)
            channelGroups.insert(channelGroups.end(),group);
    }

    if (favGroup.channels.size() > 0)
        channelGroups.insert(channelGroups.end(),favGroup);
}
开发者ID:quequino,项目名称:pvr.zattoo,代码行数:69,代码来源:ZatData.cpp

示例5: JOYNR_LOG_ERROR

void Dispatcher::handleRequestReceived(const JoynrMessage& message)
{
    std::string senderId = message.getHeaderFrom();
    std::string receiverId = message.getHeaderTo();

    // json request
    // lookup necessary data
    std::string jsonRequest = message.getPayload();
    std::shared_ptr<RequestCaller> caller = requestCallerDirectory.lookup(receiverId);
    if (caller == nullptr) {
        JOYNR_LOG_ERROR(
                logger,
                "caller not found in the RequestCallerDirectory for receiverId {}, ignoring",
                receiverId);
        return;
    }
    std::string interfaceName = caller->getInterfaceName();

    // Get the request interpreter that has been registered with this interface name
    std::shared_ptr<IRequestInterpreter> requestInterpreter =
            InterfaceRegistrar::instance().getRequestInterpreter(interfaceName);

    // deserialize json
    try {
        Request request = JsonSerializer::deserialize<Request>(jsonRequest);

        std::string requestReplyId = request.getRequestReplyId();
        JoynrTimePoint requestExpiryDate = message.getHeaderExpiryDate();

        std::function<void(std::vector<Variant>)> onSuccess =
                [requestReplyId, requestExpiryDate, this, senderId, receiverId](
                        std::vector<Variant> returnValueVar) {
            Reply reply;
            reply.setRequestReplyId(requestReplyId);
            reply.setResponse(std::move(returnValueVar));
            // send reply back to the original sender (ie. sender and receiver ids are reversed
            // on
            // purpose)
            JOYNR_LOG_DEBUG(logger,
                            "Got reply from RequestInterpreter for requestReplyId {}",
                            requestReplyId);
            JoynrTimePoint now = std::chrono::time_point_cast<std::chrono::milliseconds>(
                    std::chrono::system_clock::now());
            std::int64_t ttl = std::chrono::duration_cast<std::chrono::milliseconds>(
                                       requestExpiryDate - now).count();
            messageSender->sendReply(receiverId, // receiver of the request is sender of reply
                                     senderId,   // sender of request is receiver of reply
                                     MessagingQos(ttl),
                                     reply);
        };

        std::function<void(const exceptions::JoynrException&)> onError =
                [requestReplyId, requestExpiryDate, this, senderId, receiverId](
                        const exceptions::JoynrException& exception) {
            Reply reply;
            reply.setRequestReplyId(requestReplyId);
            reply.setError(joynr::exceptions::JoynrExceptionUtil::createVariant(exception));
            JOYNR_LOG_DEBUG(logger,
                            "Got error reply from RequestInterpreter for requestReplyId {}",
                            requestReplyId);
            JoynrTimePoint now = std::chrono::time_point_cast<std::chrono::milliseconds>(
                    std::chrono::system_clock::now());
            std::int64_t ttl = std::chrono::duration_cast<std::chrono::milliseconds>(
                                       requestExpiryDate - now).count();
            messageSender->sendReply(receiverId, // receiver of the request is sender of reply
                                     senderId,   // sender of request is receiver of reply
                                     MessagingQos(ttl),
                                     reply);
        };
        // execute request
        requestInterpreter->execute(caller,
                                    request.getMethodName(),
                                    request.getParams(),
                                    request.getParamDatatypes(),
                                    onSuccess,
                                    onError);
    } catch (const std::invalid_argument& e) {
        JOYNR_LOG_ERROR(logger,
                        "Unable to deserialize request object from: {} - error: {}",
                        jsonRequest,
                        e.what());
        return;
    }
}
开发者ID:zabela,项目名称:joynr,代码行数:84,代码来源:Dispatcher.cpp

示例6: GotHeaderStatic

	static size_t GotHeaderStatic( void *ptr, size_t size, size_t nmemb, void *userdata)
	{
		Request *mem = (Request *)userdata;
		return mem->GotHeader((const char *)ptr,size*nmemb);
	}
开发者ID:h1048576,项目名称:libcurl,代码行数:5,代码来源:libcurl-example-workaround.cpp

示例7: operator

onion_connection_status StaticHandler::operator()(Request &req, Response &res)
{
	return onion_shortcut_response_file((path+req.path()).c_str(), req.c_handler(), res.c_handler());
}
开发者ID:IPInfusion,项目名称:SDN-IP,代码行数:4,代码来源:extrahandlers.cpp

示例8: s3eFree

void CIwHTTPQueue::Update()
{
	if (m_Request.size())
	{
		if (g_GotResult)
		{
			m_HTTP.Cancel();
			g_GotResult = false;

			Request request = m_Request[0];
			m_Request.erase(0);

			if (g_Result)
			{
				// Call the requests callback with the received data
				if (request.Callback)
				{
					request.Callback(request.pArgument, (const char*)g_szContentType, g_Result, g_ResultLen);
				}

				// Free result
				s3eFree(g_Result);
				g_szContentType[0] = 0;
				g_Result = 0;
			}
			else
			{
				if (request.CallbackError)
				{
					request.CallbackError(request.pArgument);
				}
			}

			delete[] (char*)request.pURL;

			// Begin fetching the next request
			if (m_Request.size())
			{
				if (m_Request[0].Callback)
				{
					if (m_Request[0].usePost)
					{
						m_timeout = m_Request[0].timeout;
						m_requestStart = s3eTimerGetMs();
						m_HTTP.Post(m_Request[0].pURL, m_Request[0].szBuffer, m_Request[0].bufferLen, GotHeaders, NULL);
					}
					else
					{
						m_timeout = m_Request[0].timeout;
						m_requestStart = s3eTimerGetMs();
						m_HTTP.Get(m_Request[0].pURL, GotHeaders, NULL);
					}
				}
				else
				{
					g_GotResult = true;
				}
			}
		}
		else
		{
			uint64 now = s3eTimerGetMs();

			if (m_Request[0].timeout != -1 && (now - m_requestStart) > m_Request[0].timeout)
			{
				m_Request[0].timeout = -1;
				g_GotResult = true;
				m_HTTP.Cancel();
				s3eDeviceYield(0);
			}
		}
	}
}
开发者ID:nbclark,项目名称:paint-by-runners,代码行数:73,代码来源:IwHTTPQueue.cpp

示例9: qDebug

    int PamBackend::converse(int n, const struct pam_message **msg, struct pam_response **resp) {
        qDebug() << "[PAM] Conversation with" << n << "messages";

        bool newRequest = false;

        if (n <= 0 || n > PAM_MAX_NUM_MSG)
            return PAM_CONV_ERR;

        for (int i = 0; i < n; i++) {
            switch(msg[i]->msg_style) {
                case PAM_PROMPT_ECHO_OFF:
                case PAM_PROMPT_ECHO_ON:
                    newRequest = m_data->insertPrompt(msg[i], n == 1);
                    break;
                case PAM_ERROR_MSG:
                    m_app->error(QString::fromLocal8Bit(msg[i]->msg), Auth::ERROR_AUTHENTICATION);
                    break;
                case PAM_TEXT_INFO:
                    // if there's only the info message, let's predict the prompts too
                    m_app->info(QString::fromLocal8Bit(msg[i]->msg), m_data->handleInfo(msg[i], n == 1));
                    break;
                default:
                    break;
            }
        }

        if (newRequest) {
            Request sent = m_data->getRequest();
            Request received;

            if (sent.valid()) {
                received = m_app->request(sent);

                if (!received.valid())
                    return PAM_CONV_ERR;

                m_data->completeRequest(received);
            }
        }

        *resp = (struct pam_response *) calloc(n, sizeof(struct pam_response));
        if (!*resp) {
            return PAM_BUF_ERR;
        }

        for (int i = 0; i < n; i++) {
            QByteArray response = m_data->getResponse(msg[i]);

            resp[i]->resp = (char *) malloc(response.length() + 1);
            // on error, get rid of everything
            if (!resp[i]->resp) {
                for (int j = 0; j < n; j++) {
                    free(resp[i]->resp);
                    resp[i]->resp = nullptr;
                }
                free(*resp);
                *resp = nullptr;
                return PAM_BUF_ERR;
            }

            memcpy(resp[i]->resp, response.constData(), response.length());
            resp[i]->resp[response.length()] = '\0';
        }

        return PAM_SUCCESS;
    }
开发者ID:hykwok,项目名称:sddm,代码行数:66,代码来源:PamBackend.cpp

示例10: switch

bool HttpClient::init(HTTPRequest *ptHttpRequest,Request &request,ExecutionContent &executionContent)
{
	bool rtn = false;
	ptHttpRequest->delegate = this;
	ptHttpRequest->timeOutSeconds = _clientConfiguration.connectionTimeout;
	ptHttpRequest->userAgent = _clientConfiguration.userAgent;
	if ( !_clientConfiguration.proxyHost.empty() && _clientConfiguration.proxyPort > 0)
	{
		ptHttpRequest->proxyHost = _clientConfiguration.proxyHost;
		ptHttpRequest->proxyPort = _clientConfiguration.proxyPort;
		ptHttpRequest->proxyUserName = _clientConfiguration.proxyUserName;
		ptHttpRequest->proxyPassword = _clientConfiguration.proxyPassword;
		ptHttpRequest->proxyDomain = _clientConfiguration.proxyWorkstation;
	}
	ptHttpRequest->requestMethod = request.method;
	switch (request.method)
	{
	case HttpMethod_GET:
		{
		}
		break;
		case HttpMethod_PUT:
		{
			ptHttpRequest->addPostData(request.getContent(),request.getContentLength());
		}
		break;
		case HttpMethod_POST:
		{
			ptHttpRequest->addPostData(request.getContent(),request.getContentLength());
		}
		break;
		case HttpMethod_HEAD:
		{
		}
		break;
		case HttpMethod_DELETE:
		{
		}
		break;
		
	default:
		break;
	}
	map<string,string> dictHeaders = request.getHeaders();
	map < string, string >::iterator iter=dictHeaders.begin();
	for (iter = dictHeaders.begin(); iter != dictHeaders.end(); iter++ ) 
	{
		string key = iter->first;
		string value = iter->second;
	//	std::transform(key.begin(), key.end(), key.begin(), ::tolower);
		if(key.compare("Content-Length")==0 ||key.compare("Host")==0) 
		{
			continue;
		}
		ptHttpRequest->addRequestHeader(key,value);
	}

	iter= dictHeaders.find("Content-Type");
	if(iter == dictHeaders.end()) {
		ptHttpRequest->addRequestHeader("Content-Type","");
	}
	rtn = true;
	iter = request.userInfo.find("method");
	if(iter != request.userInfo.end())
	{
		if(iter->second.compare("FetchObject") == 0)
		{
			map < string, string >::iterator iter2 = request.userInfo.find("path");
			if(iter2 != request.userInfo.end())
			{
				rtn = ptHttpRequest->SetReciveFile(iter2->second);
			}
		}
	}

	return rtn ;
}
开发者ID:barrycug,项目名称:Aliyun-OSS-CPP-SDK,代码行数:77,代码来源:HttpClient.cpp

示例11: handle

 virtual std::shared_ptr<Response> handle(
         const CrackedUri &/*uri*/, const Request &request) override {
     return make_shared<AsyncResponse>(request.server());
 }
开发者ID:offa,项目名称:seasocks,代码行数:4,代码来源:async_test.cpp

示例12: refToBlock

void 
Ndbfs::execFSAPPENDREQ(Signal * signal)
{
  const FsAppendReq * const fsReq = (FsAppendReq *)&signal->theData[0];
  const Uint16 filePointer =  (Uint16)fsReq->filePointer;
  const UintR userPointer = fsReq->userPointer; 
  const BlockReference userRef = fsReq->userReference;
  const BlockNumber blockNumber = refToBlock(userRef);

  FsRef::NdbfsErrorCodeType errorCode;

  AsyncFile* openFile = theOpenFiles.find(filePointer);
  const NewVARIABLE *myBaseAddrRef = &getBat(blockNumber)[fsReq->varIndex];

  const Uint32* tWA   = (const Uint32*)myBaseAddrRef->WA;
  const Uint32  tSz   = myBaseAddrRef->nrr;
  const Uint32 offset = fsReq->offset;
  const Uint32 size   = fsReq->size;
  const Uint32 synch_flag = fsReq->synch_flag;
  Request *request = theRequestPool->get();

  if (openFile == NULL) {
    jam();
    errorCode = FsRef::fsErrFileDoesNotExist;
    goto error;
  }

  if (myBaseAddrRef == NULL) {
    jam(); // Ensure that a valid variable is used
    errorCode = FsRef::fsErrInvalidParameters;
    goto error;
  }
  
  if (fsReq->varIndex >= getBatSize(blockNumber)) {
    jam();// Ensure that a valid variable is used    
    errorCode = FsRef::fsErrInvalidParameters;
    goto error;
  }
  
  if(offset + size > tSz){
    jam(); // Ensure that a valid variable is used
    errorCode = FsRef::fsErrInvalidParameters;
    goto error;
  }

  request->error = 0;
  request->set(userRef, userPointer, filePointer);
  request->file = openFile;
  request->theTrace = signal->getTrace();
  
  request->par.append.buf = (const char *)(tWA + offset);
  request->par.append.size = size << 2;

  if (!synch_flag)
    request->action = Request::append;
  else
    request->action = Request::append_synch;
  ndbrequire(forward(openFile, request));
  return;
  
error:
  jam();
  theRequestPool->put(request);
  FsRef * const fsRef = (FsRef *)&signal->theData[0];
  fsRef->userPointer = userPointer;
  fsRef->setErrorCode(fsRef->errorCode, errorCode);
  fsRef->osErrorCode = ~0; // Indicate local error

  jam();
  sendSignal(userRef, GSN_FSAPPENDREF, signal, 3, JBB);
  return;
}
开发者ID:Abner-Sun,项目名称:mysql5.1-vx-pre1,代码行数:72,代码来源:Ndbfs.cpp

示例13: jamEntry

void 
Ndbfs::execFSOPENREQ(Signal* signal)
{
  jamEntry();
  const FsOpenReq * const fsOpenReq = (FsOpenReq *)&signal->theData[0];
  const BlockReference userRef = fsOpenReq->userReference;
  AsyncFile* file = getIdleFile();
  ndbrequire(file != NULL);
  Filename::NameSpec spec(theFileSystemPath, theBackupFilePath);

  Uint32 userPointer = fsOpenReq->userPointer;
  
  if(fsOpenReq->fileFlags & FsOpenReq::OM_INIT)
  {
    Ptr<GlobalPage> page_ptr;
    if(m_global_page_pool.seize(page_ptr) == false)
    {
      FsRef * const fsRef = (FsRef *)&signal->theData[0];
      fsRef->userPointer  = userPointer; 
      fsRef->setErrorCode(fsRef->errorCode, FsRef::fsErrOutOfMemory);
      fsRef->osErrorCode  = ~0; // Indicate local error
      sendSignal(userRef, GSN_FSOPENREF, signal, 3, JBB);
      return;
    }
    file->m_page_ptr = page_ptr;
  } 
  else
  {
    ndbassert(file->m_page_ptr.isNull());
    file->m_page_ptr.setNull();
  }
  
  if(signal->getNoOfSections() == 0){
    jam();
    file->theFileName.set(spec, userRef, fsOpenReq->fileNumber);
  } else {
    jam();
    SegmentedSectionPtr ptr;
    signal->getSection(ptr, FsOpenReq::FILENAME);
    file->theFileName.set(spec, ptr, g_sectionSegmentPool);
    releaseSections(signal);
  }
  file->reportTo(&theFromThreads);
  if (getenv("NDB_TRACE_OPEN"))
    ndbout_c("open(%s)", file->theFileName.c_str());
  
  Request* request = theRequestPool->get();
  request->action = Request::open;
  request->error = 0;
  request->set(userRef, userPointer, newId() );
  request->file = file;
  request->theTrace = signal->getTrace();
  request->par.open.flags = fsOpenReq->fileFlags;
  request->par.open.page_size = fsOpenReq->page_size;
  request->par.open.file_size = fsOpenReq->file_size_hi;
  request->par.open.file_size <<= 32;
  request->par.open.file_size |= fsOpenReq->file_size_lo;
  request->par.open.auto_sync_size = fsOpenReq->auto_sync_size;
  
  ndbrequire(forward(file, request));
}
开发者ID:Abner-Sun,项目名称:mysql5.1-vx-pre1,代码行数:61,代码来源:Ndbfs.cpp

示例14: GotProgressStatic

	static int GotProgressStatic(void *clientp,double dltotal,double dlnow,double ultotal,double ulnow)
	{
		Request *mem = (Request *)clientp;
		return mem->GotProgress(dltotal,dlnow,ultotal,ulnow);
	}
开发者ID:h1048576,项目名称:libcurl,代码行数:5,代码来源:libcurl-example-workaround.cpp

示例15: set_connection_header

 void set_connection_header(Request& req) const
 {
   req.header().set_field(header::Connection,
   (keep_alive_) ? std::string{"keep-alive"} : std::string{"close"});
 }
开发者ID:AnnikaH,项目名称:IncludeOS,代码行数:5,代码来源:basic_client.hpp


注:本文中的Request类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。