Example #1
0
void BaseRequest::onDataTail(void* ctx, int dataLength, char* data) {
    BaseRequest* request        = static_cast<BaseRequest*>(ctx);
    
    request->m_dataTail         = data;
    request->m_dataTailLength   = dataLength;
    
    request->sendStream();
}
Example #2
0
void MpiWorker::TakeRequests()
{
	//printf("TAKE.Id:%dIter:%d.Rsize:%d\n", Id, IterNumber,Requests.size());
	int code[3];
	MPI_Status status;
	MPI_Recv(code, 3, MPI_INT, 0,  REQ_SEND_CODE , MPI_COMM_WORLD, &status);
	int x = true;
	MPI_Send(&x, 1, MPI_INT, 0,  REQ_ACCEPT_CODE , MPI_COMM_WORLD);
	BaseRequest req = CodeToReq(code);
	//printf("TAKEEND.Id:%dIter:%d!TEXT:%s\n", Id, IterNumber, req.GetType().c_str());
	if (req.GetType() != "0")
		Requests.push_back(req); 
}
Example #3
0
void BaseRequest::onDataHead(void* ctx, int dataLength, char* data) {
    BaseRequest* request        = static_cast<BaseRequest*>(ctx);
    
    if (data) {
        request->m_dataHead         = data;
        request->m_dataHeadLength   = dataLength;
    
        int initCmdLen              = 10 + strlen(request->m_target);
        char* initCmd               = new char[initCmdLen + 1];

        sprintf(initCmd, "0 INIT %s \r\n", request->m_target);
        Manager::acquireCommConnection()->cmd(initCmd, initCmdLen, request, onCommInit); 
    } else {
        request->sendStream();
    }
}
Example #4
0
void DefaultClientHeaders::requestFilter(Context& context,
                                         BaseRequest& request) const
{
    const ClientSessionSettings& settings = context.getClientSessionSettings();

    if (!settings.getUserAgent().empty())
    {
        request.set("User-Agent", settings.getUserAgent());
    }

//    request.set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
//    request.set("Accept-Language", "en-US,en;q=0.8");

    for (const auto& entry: settings.getDefaultHeaders())
    {
        request.set(entry.first, entry.second);
    }
}
Example #5
0
/*
 * 定期更新処理。
 */
void LoadingLayer::draw()
{
    DialogBaseLayer::draw();
    // 通信初期化
    if( state == STATE_CONNECT_INIT )
    {
        if( connectIndex >= ConnectRequestList::shared()->getCount() )
        {
            state = STATE_NEXT;
        }
        else
        {
            CCLog( "LoadingLayer::accessPho connectIndex=%d", connectIndex );
            
            BaseRequest* req = ConnectRequestList::shared()->getObject( connectIndex );
            NetworkManager::sharedInstance()->NetworkRequestPost(req->getFullUrl(), req->getFullData(), "", this, httpresponse_selector(LoadingLayer::responseParser));
            m_isFinished = false;
            state = STATE_CONNECT_LOOP;
        }
    }

    // 通信終了待ち
    if( state == STATE_CONNECT_LOOP )
    {
        if( m_isFinished )
        {
            state = STATE_CONNECT_INIT;
            connectIndex++;
        }
    }
    
    // 次の画面へ
    if( state == STATE_NEXT )
    {
        changeNextScene();
    }
}
void DefaultResponseStreamFilter::requestFilter(BaseRequest& request,
        Context&)
{
    // Set the headers indicating the encodings we can decode.
    request.set(ACCEPT_ENCODING_HEADER, "gzip, deflate");
}