void UT_CIceConnectionHandler::UT_CNATFWConnectionHandler_IncomingMessageLL(  )
    {
    TInetAddr localAddr( KLocalAddr );
    TInetAddr fromAddr( KRemoteAddr );
    TInetAddr peerAddr( KRemoteAddr );
    
    _LIT8( KDummyContent, "dummycontent" );
    TBool consumed( EFalse );
    
    // no connection
    EUNIT_ASSERT_LEAVE( iConnectionHandler->IncomingMessageL( 
        iStreamId, KDummyContent, localAddr, fromAddr, peerAddr, consumed ) );
    
    TUint stunConnection = iConnectionHandler->CreateConnectionL( *iPairs[0] );
    
    // unknown sream
    EUNIT_ASSERT_NO_LEAVE( iConnectionHandler->IncomingMessageL( 
        iStreamId + 1, KDummyContent, 
        localAddr, fromAddr, peerAddr, consumed ) );
    EUNIT_ASSERT( !consumed );
    
    // known stream
    TUint stunConnection2 = iConnectionHandler->CreateConnectionL( *iPairs[0] );
    EUNIT_ASSERT_NO_LEAVE( iConnectionHandler->IncomingMessageL( 
        iStreamId, KDummyContent, localAddr, fromAddr, peerAddr, consumed ) );
    
    iConnectionHandler->RemoveConnection( iStreamId, stunConnection );
    iConnectionHandler->RemoveConnection( iStreamId, stunConnection2 );
    }
void UT_CNATFWStunConnectionHandler::
    UT_CNATFWStunConnectionHandler_IncomingMessageLL(  )
    {
    TInetAddr dummyAddr;
    const TInetAddr dummyAddr2;
    HBufC8* dummyMessage = NULL;
    TBool consumed( EFalse );
    
    // Create STUN Client
    iConnHandler->TryNextServerL();
    
    // Create connections to array
    iConnHandler->FetchCandidateL( iStreamId, 0, KAFUnspec, KAFUnspec );
    CSTUNBinding* dummyBinding = CSTUNBinding::NewL(
        *iConnHandler->iStunClient, iStreamId, 2 );
    iConnHandler->iStreamArray[0].iConnArray[0].iStunBinding = dummyBinding;
    iConnHandler->FetchCandidateL( iStreamId, 0, KAFUnspec, KAFUnspec );

    NATFW_EUNIT_ASSERT_NO_LEAVE( iConnHandler->IncomingMessageL( 333,
                                                           *dummyMessage,
                                                           dummyAddr2,
                                                           dummyAddr2,
                                                           dummyAddr,
                                                           consumed ) );

    NATFW_EUNIT_ASSERT_NO_LEAVE( iConnHandler->IncomingMessageL( 222,
                                                           *dummyMessage,
                                                           dummyAddr2,
                                                           dummyAddr2,
                                                           dummyAddr,
                                                           consumed ) );
    }
Esempio n. 3
0
void FlowWriter::manage(Invoker& invoker) {
	if(!consumed() && !_band.failed()) {
		try {
			if(_trigger.raise())
				raiseMessage();
		} catch(Exception& ex) {
			fail("FlowWriter can't deliver its data, "+ex.displayText());
			throw;
		}
	}
	if(critical && _closed)
		throw Exception("Main flow writer closed, session is closing");
	flush();
}
Esempio n. 4
0
void toEventQuery::start()
{
    if ( Worker || Started || WorkDone )
        throw tr("toEventQuery::start - can not restart already stared query");

    Worker = new toEventQueryWorker(this, Connection, CancelCondition, SQL, Param);
    Worker->moveToThread(Thread);
    Thread->Slave = Worker;

    // Connect to Worker's API
    connect(Worker, SIGNAL(headers(toQColumnDescriptionList &, int)),      //  BG -> main
            this, SLOT(slotDesc(toQColumnDescriptionList &, int)));

    connect(Worker, SIGNAL(data(const ValuesList &)),                      //  BG -> main
            this, SLOT(slotData(const ValuesList &)));

    connect(Worker, SIGNAL(error(const toConnection::exception &)),        //  BG -> main
            this, SLOT(slotError(const toConnection::exception &)));

    connect(Worker, SIGNAL(workDone()),                                    //  BG -> main
            this, SLOT(slotFinished()));

    connect(Worker, SIGNAL(rowsProcessed(unsigned long)),                  //  BG -> main
            this, SLOT(slotRowsProcessed(unsigned long)));

    connect(this,   SIGNAL(dataRequested()),  Worker, SLOT(slotRead()));   // main -> BG

    connect(this,   SIGNAL(consumed()),       Worker, SLOT(slotRead()));   // main -> BG

    // Connect to QThread's API
    //  error handling
    connect(Worker, SIGNAL(error(toConnection::exception const &))         //  BG -> main
            , this, SLOT(slotError(toConnection::exception const &)));
    //  initization
    connect(Thread, SIGNAL(started()),        Worker, SLOT(init()));       // main -> BG
    connect(Worker, SIGNAL(started()),        this,   SLOT(slotStarted()));// BG   -> main
    //  finish
    connect(Worker, SIGNAL(finished()),       Thread, SLOT(quit()));          // BG -> BG?? (quit event loop)
    connect(Worker, SIGNAL(finished()),       Worker, SLOT(deleteLater()));   // BG -> BG
    connect(Thread, SIGNAL(finished()),       Thread, SLOT(deleteLater()));   // BG -> main
    connect(Thread, SIGNAL(destroyed()),      this,   SLOT(slotThreadEnd())); // main -> main
    connect(this,   SIGNAL(stopRequested()),  Worker, SLOT(slotStop()));      // main -> BG

    TLOG(7, toDecorator, __HERE__) << "toEventQuery start" << std::endl;
    // finally start the thread
    Thread->start();
}
Esempio n. 5
0
void RTMFPWriter::manage(Exception& ex, Invoker& invoker) {
	if(!consumed() && !_band.failed()) {
		
		if(_trigger.raise(ex))
			raiseMessage();

		if (ex) {
			fail("RTMFPWriter can't deliver its data, ",ex.error());
			return;
		}
	}
	if(critical && state()==CLOSED) {
		ex.set(Exception::NETWORK, "Main flow writer closed, session is closing");
		return;
	}
	flush(false);
}
void UT_CIceConnectionHandler::UT_CNATFWConnectionHandler_PerformConnCheckLL(  )
    {
    TInetAddr peerAddr( iPairs[0]->RemoteCandidate().TransportAddr() );
    TUint connection = iConnectionHandler->CreateConnectionL( *iPairs[0] );
    
    if ( TIceTestUtils::AllocTestEnabled() )
        {
        iConnectionHandler->PerformConnCheckL( 
            iStreamId, connection, 0, EFalse, 0, peerAddr, *this );
        }
    else
        {
        // SUCCESFULL RESPONSE
        EUNIT_ASSERT_NO_LEAVE( iConnectionHandler->PerformConnCheckL( 
            iStreamId, connection, 0, EFalse, 0, peerAddr, *this ) );
        TInetAddr localAddr;
        TInetAddr fromAddr = peerAddr;
        _LIT8( Kdummycontent, "dummycontent" );
        TBool consumed( EFalse );
        EUNIT_ASSERT_NO_LEAVE( iConnectionHandler->IncomingMessageL( 
            iStreamId, Kdummycontent, localAddr, fromAddr, peerAddr, consumed ) );
        EUNIT_ASSERT_NO_LEAVE( iConnectionHandler->STUNBindingEventOccurredL( 
            MSTUNClientObserver::EPublicAddressResolved, 
            *( iConnectionHandler->iBindings[0].iBinding ) ) );
        
        // CREDENTIALS REJECTED
        EUNIT_ASSERT_NO_LEAVE( iConnectionHandler->PerformConnCheckL( 
            iStreamId, connection, 0, EFalse, 0, peerAddr, *this ) );
        EUNIT_ASSERT_NO_LEAVE( iConnectionHandler->IncomingMessageL( 
            iStreamId, Kdummycontent, localAddr, fromAddr, peerAddr, consumed ) );
        
        EUNIT_ASSERT_NO_LEAVE( iConnectionHandler->STUNBindingEventOccurredL( 
            MSTUNClientObserver::ECredentialsRejected, 
            *( iConnectionHandler->iBindings[0].iBinding ) ) );
        }
    
    iConnectionHandler->RemoveConnection( iStreamId, connection );
    }
Esempio n. 7
0
    explicit LifeVarEntry(CONSUMED) {
	init(false); consumed();
    }