/*====================Standart Routines====================*/
extern void StdRt_Node_Manage_ReqestExe(ObjDescType nds)
{
  size_t idx;
  RequestStatusType rq_sts;
  RequestBehaivorType rq_type;
  ObjDescType rqds;
  NodeType pnode=GetNodePtr(nds);

  if(!pnode)
    {
      return;
    }
  
  for(idx=0;idx<;idx++)
    {
      rqds=ObjList_GetItem(pnode->pReqList,idx);
      if(!rqds) continue;

      if(Request_IsLifeTimeOver(rqds))
	{
	  DbgPrint(("Request[%d]: timeout\n"));
	  if(!CancelRequest(rqds))
	    {
	      DbgPrint(("Request[%d]: canceling fail\n",rqds));  
	    }
	  else
	    {
	      DbgPrint(("Request[%d]: canceled\n",rqds));
	    }
	}

      if(Request_IsCompleted(rqds))
	{
	  DbgPrint(("Request[%d]: complete\n",rqds));

	  if(!Node_CompleteRequest(pnode, rqds))
	    {
	      DbgPrint(("Request[%d]: completition fail\n"));
	    } 
	}

      
      rq_sts=GetRequestStatus(rqds);
			      
      switch(rq_sts)
	{
	case REQUEST_UNKNOWN:
	  DbgPrint(("Request[%d]: unknown\n"));
	  if(!CancelRequest(rqds))
	    {
	      {
		  DbgPrint(("Request[%d]: canceling fail\n",rqds));  
		}
	      else
		{
		  DbgPrint(("Request[%d]: canceled\n",rqds));
		}
	      
	    }
void COcspSupportSession::HandleSendRequestL(const RMessage2& aMessage)
	{
	iIap = aMessage.Int3();
	CancelRequest();

	iOcspQueryRunner=COcspQueryRunner::NewL(iServer.CreateTransportL(iIap), aMessage);	
	}
VOID OnCancelWrite(IN PDEVICE_OBJECT fdo, IN PIRP Irp)
{
    PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
    
    CancelRequest( &pdx->dqWrite, Irp );
    
    IoReleaseRemoveLock( &pdx->RemoveLock, Irp );
}
void        PtpGetOrientation( CAMPtr thisCam, CAMRecPtr pcr)

{
    uint32_t        rc = 0;
    uint32_t        cnt;
    uint32_t        orientation;
    CAMReadData     crd;
    char *          pbuf = crd.data;

do {
    cnt = sizeof(crd.data);

    // there are 3 ways to get the first 500 bytes;
    // the one we use depends on what the camera supports
    if (thisCam->camFlags & CAM_PARTIAL_STANDARD)
        rc = GetPartialObject( thisCam->hCam, pcr->hndl, 0,
                               &cnt, &pbuf);
    else
    if (thisCam->camFlags & CAM_PARTIAL_CANON)
        rc = CanonGetPartialObject( thisCam->hCam, pcr->hndl, 0,
                                    &cnt, 0, &pbuf);
    else {
        // this one is ugly, start fetching the entire image,
        // then kill it after the first read (it works, though)
        rc = ReadObjectBegin( thisCam->hCam, pcr->hndl, &cnt, &crd);
        if (rc == PTP_RC_OK)
            rc = CancelRequest( thisCam->hCam);
    }

    // something went wrong
    if (rc || cnt < 500) {
        camcli_error( "GetPartial failed for handle %ld - count= %ld  rc= 0x%lx",
                      pcr->hndl, cnt, rc);
        if (rc)
            ClearStall( thisCam->hCam);
        break;
    }

    // parse the Exif info looking for orientation info
    rc = PtpFindOrientation( crd.data, cnt, &orientation);
    if (rc) {
        camcli_error( "FindOrientation failed for handle %ld - rc= 0x%lx",
                      pcr->hndl, rc);
        break;
    }

    SetOrientation( orientation, pcr);

} while (0);

    return;
}
Beispiel #5
0
VOID
DereferenceContext(
    PMYCONTEXT pContext
    )
{
    LONG lRefCount;
    lRefCount = InterlockedDecrement(&pContext->ReferenceCount);
    if (lRefCount == 0)
    {
        CancelRequest(pContext);
        FreeMyContext(pContext);
    }
}
Beispiel #6
0
DWORD
EndRequest(
    PMYCONTEXT pContext
    )

/*++

Routine Description:

    Waits for request to complete.

Arguments:

    pContext - Request context to wait for.

Return Value:

    None.

--*/

{
    DWORD dwError = ERROR_SUCCESS;

    if (WaitForSingleObject(pContext->RequestFinishedEvent, 
                            INFINITE) == WAIT_FAILED)
    {
        dwError = GetLastError();
        printf("WaitForSingleObject failed\n");
        goto Exit;
    }

    dwError = pContext->LastError;

Exit:

    //
    // Success or failure, we're done with this RequestHandle.
    //

    CancelRequest(pContext);

    return dwError;
}
Beispiel #7
0
DWORD
WINAPI
DemoCancelThreadFunc(
    LPVOID lpParameter
    )

/*++

Routine Description:

    Background thread to demonstrate async cancellation.

Arguments:

    lpParameter - Request context to cancel.

Return Value:

    Thread exit value.

--*/

{
    PMYCONTEXT pContext = (PMYCONTEXT)lpParameter;

    srand((unsigned)time(NULL));
    if (rand() % 2 == 0)
    {
        //
        // Make the cancellation race interesting by sleeping sometimes ..
        //

        printf("DemoCancelThreadFunc sleeping..\n");
        Sleep(100);
    }
    else
    {
        printf("DemoCancelThreadFunc NOT sleeping..\n");
    }

    CancelRequest(pContext);
    DereferenceContext(pContext);
    return ERROR_SUCCESS;
}
Beispiel #8
0
int Logic::cancelRequest(cynara_check_id checkId) {
    if (!m_operationPermitted)
        return CYNARA_API_OPERATION_NOT_ALLOWED;

    if (!ensureConnection())
        return CYNARA_API_SERVICE_NOT_AVAILABLE;

    auto it = m_checks.find(checkId);
    if (it == m_checks.end() || it->second.cancelled())
        return CYNARA_API_INVALID_PARAM;

    m_socketClient.appendRequest(CancelRequest(it->first));

    it->second.cancel();

    bool onAnswerCancel = m_inAnswerCancelResponseCallback;
    m_inAnswerCancelResponseCallback = true;
    it->second.callback().onCancel(it->first);
    m_inAnswerCancelResponseCallback = onAnswerCancel;

    onStatusChange(m_socketClient.getSockFd(), cynara_async_status::CYNARA_STATUS_FOR_RW);

    return CYNARA_API_SUCCESS;
}
// -----------------------------------------------------------------------------
// COMASuplPosSession::CancelInitialize
// Cancels an outstanding request to initialize
// -----------------------------------------------------------------------------
//
void COMASuplPosSession::CancelInitialize()
    {
    iIsInitialized = EFalse;
    CancelRequest();
    }
// -----------------------------------------------------------------------------
// COMASuplPosSession::SessionEnd
// Terminates a SUPL POS Session
// -----------------------------------------------------------------------------
//
void COMASuplPosSession::SessionEnd()
    {
    CancelRequest();
    iIsInitialized = EFalse;
    }
// -----------------------------------------------------------------------------
// COMASuplPosSession::CancelGetPosition
// Cancels an outstanding request to GetPositionL
// -----------------------------------------------------------------------------
//
void COMASuplPosSession::CancelGetPosition()
    {
    CancelRequest();
    }
// -----------------------------------------------------------------------------
// COMASuplPosSession::CancelSuplInfoRequest
// Cancels an outstanding request to GetSuplInfoL
// -----------------------------------------------------------------------------
//
void COMASuplPosSession::CancelSuplInfoRequest()
    {
    CancelRequest();
    }
Beispiel #13
0
	int TLServer_IP::ServiceMessage(int MessageType, CString msg)
	{
		switch (MessageType)
		{
			case ORDERCANCELREQUEST :
				return CancelRequest((long)atoi(msg.GetBuffer()));
			case ACCOUNTREQUEST :
				return AccountResponse(msg);
			case CLEARCLIENT :
				return ClearClient(msg);
			case CLEARSTOCKS :
				return ClearStocks(msg);
			case REGISTERSTOCK :
				{
				vector<CString> rec;
				gsplit(msg,CString("+"),rec);
				CString client = rec[0];
				vector<CString> hisstocks;
				// make sure client sent a basket, otherwise clear the basket
				if (rec.size()!=2) return ClearStocks(client);
				// get the basket
				gsplit(rec[1],CString(","),hisstocks);
				// make sure we have the client
				unsigned int cid = FindClient(client); 
				if (cid==-1) return CLIENTNOTREGISTERED; //client not registered
				// save the basket
				stocks[cid] = hisstocks; 
				D(CString(_T("Client ")+client+_T(" registered: ")+gjoin(hisstocks,",")));
				HeartBeat(client);
				return RegisterStocks(client);
				}
			case POSITIONREQUEST :
				{
				vector<CString> r;
				gsplit(msg,CString("+"),r);
				if (r.size()!=2) return UNKNOWN_MESSAGE;
				return PositionResponse(r[1],r[0]);
				}
			case REGISTERCLIENT :
				return RegisterClient(msg);
			case HEARTBEAT :
				return HeartBeat(msg);
			case BROKERNAME :
				return BrokerName();
			case SENDORDER :
				return SendOrder(TLOrder::Deserialize(msg));
			case FEATUREREQUEST:
				{
					// get features supported by child class
					std::vector<int> stub = GetFeatures();
					// append basic feature we provide as parent
					stub.push_back(REGISTERCLIENT);
					stub.push_back(HEARTBEAT);
					stub.push_back(CLEARSTOCKS);
					stub.push_back(CLEARCLIENT);
					stub.push_back(VERSION);
					// send entire feature set back to client
					TLSend(FEATURERESPONSE,SerializeIntVec(stub),msg);
					return OK;
				}
			case VERSION :
					return MinorVer;
		}

		return UnknownMessage(MessageType,msg);
	}
Beispiel #14
0
 ~TorcMediaPeer()
 {
     CancelRequest();
 }
DWORD CEodStepLoadIvBands::Stop()
{
	CancelRequest();
	return 	CThread::Stop();
}
void COcspSupportSession::HandleCancelRequest(const RMessage2& aMessage)
	{
	CancelRequest();
	aMessage.Complete(KErrNone);
	}
COcspSupportSession::~COcspSupportSession()
	{
	CancelRequest();
	delete iOcspQueryRunner;
	iServer.DropSession();
	}
// ---------------------------------------------------------
// CPosPSYRequester::DoCancel
// 
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosPSYRequester::DoCancel()
    {
	CancelRequest();
	}
/*
 * 
 * 
 * @internalComponent
 */
void CSaaEmergencyCallRfAdaptation::Cancel()
	{
	CancelRequest();
	}