Exemplo n.º 1
0
void entry(void)
{

    /* -----------------------------------------------------------
     *
     * Open file stream
     *
     *
     * -----------------------------------------------------------
     */

    if(openHost (COM0)==TRUE)
    {
        banner ();
        shell  ();
    }

    /* -----------------------------------------------------------
     *
     * The closing the HostPort should *never* occur
     *
     * -----------------------------------------------------------
     */

    closeHost ();
}
Exemplo n.º 2
0
void C_EntryTask3(void) 
{
  volatile int delay;

 /* -----------------------------------------------------------
  *
  * Open file stream
  *
  *
  * -----------------------------------------------------------
  */

 if(openHost (COM0)==TRUE)
 {
 banner ();
 shell  ();
 }

/* -----------------------------------------------------------
 *
 * Closing the HostPort should *never* occur
 *
 * -----------------------------------------------------------
 */

closeHost ();

  while (1) 
  {
  delay=0xbeef003;
  }
}
Exemplo n.º 3
0
TEST_F(P2pSessionTest, testLimitPeers)
{
    const int maxPeers = 2;

    hostSession_->close();
    openHost("", maxPeers);

    const int peerCount = 2;
    P2pSession* peers[peerCount];
    TestP2pEventHandler eventHandlers[peerCount];
    for (int i = 0; i < peerCount; ++i) {
        peers[i] = P2pSessionFactory::create(PeerId(2 + i), eventHandlers[i]);
        EXPECT_TRUE(peers[i]->open(ACE_DEFAULT_SERVER_PORT + (u_short)i + 1)) <<
            "#" << i << "peer";
        peers[i]->connect(getHostAddresses());
    }

    for (int x = 0; x < (peerCount * 8); ++x) {
        for (int i = 0; i < peerCount; ++i) {
            peers[i]->tick();
        }
        hostSession_->tick();
    }

    EXPECT_EQ(maxPeers, int(hostSession_->getPeerCount()));
    EXPECT_EQ(maxPeers - 1, int(hostEventHandler_.getConnectedPeers()));

    for (int i = 0; i < peerCount; ++i) {
        delete peers[i];
    }
}
Exemplo n.º 4
0
TEST_F(P2pSessionTest, testConnectWithValidPassword)
{
    const srpc::String password("12345");

    hostSession_->close();
    openHost(password);

    TestP2pEventHandler peerEventHandler;
    boost::scoped_ptr<P2pSession> peer(
        P2pSessionFactory::create(2, peerEventHandler, p2pConfig_));
    EXPECT_TRUE(peer->open(ACE_DEFAULT_SERVER_PORT + 1, password));
    peer->connect(getHostAddresses());

    const ACE_Time_Value startTime = ACE_OS::gettimeofday();
    while ((ACE_OS::gettimeofday() - startTime).msec() < getConnectDelay()) {
        peer->tick();
        hostSession_->tick();
    }

    EXPECT_EQ(invalidPeerId, peerEventHandler.getConnectFailedPeerId()) <<
        "connect succeeded";
}
Exemplo n.º 5
0
void C_EntryTask1(void) 
{
	unsigned int delay = 100;
	unsigned int * ptr = &delay;
	unsigned int cpsr_addr1 = 0x800A0000;
	unsigned int cpsr_addr2 = 0x800B0000;
	unsigned int cpsr_addr3 = 0x402fff00;

	while(1);

	/* Open file stream */
	if(openHost(COM0) == TRUE) {
		prettyPrint("the value of delay is %x\n",delay);
		prettyPrint("the value of ptr is %x\n",ptr);
	
//		for (delay = 0; delay < 0x010ffff; delay++);

		banner();
		prettyPrint("the value of delay is %x\n",delay);
		prettyPrint("value at %x is %x\n", (unsigned int*)cpsr_addr1, *(unsigned int*)cpsr_addr1);
		prettyPrint("at %x is  %x\n", ((unsigned int*)(cpsr_addr1) + 1), *((unsigned int*)(cpsr_addr1) + 1));
		prettyPrint("at %x is  %x\n", ((unsigned int*)(cpsr_addr1) + 2), *((unsigned int*)(cpsr_addr1) + 2));
		prettyPrint("value at %x is %x\n", (unsigned int*)cpsr_addr2, *(unsigned int*)cpsr_addr2);
		prettyPrint("at %x is  %x\n", ((unsigned int*)(cpsr_addr2) + 1), *((unsigned int*)(cpsr_addr2) + 1));
		prettyPrint("at %x is  %x\n", ((unsigned int*)(cpsr_addr2) + 2), *((unsigned int*)(cpsr_addr2) + 2));
		prettyPrint("value at %x is %x\n", (unsigned int*)cpsr_addr3, *(unsigned int*)cpsr_addr3);
		prettyPrint("at %x is  %x\n", ((unsigned int*)(cpsr_addr3) + 1), *((unsigned int*)(cpsr_addr3) + 1));
		prettyPrint("at %x is  %x\n", ((unsigned int*)(cpsr_addr3) + 2), *((unsigned int*)(cpsr_addr3) + 2));
		shell();
	}

	/* Closing the HostPort should *never* occur */

	closeHost();

	while(1) 
		delay=0xbeef003;
}