Browse Source

thread dla peer1 i peer2 + poprawki

master
Piotr Dergun 7 years ago
parent
commit
ef51e1bdff
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      Simulation.cpp

+ 4
- 3
Simulation.cpp View File

@ -119,9 +119,6 @@ void * Simulation::threadWrapper(void * context)
{ {
case NODE_RECV: case NODE_RECV:
((Node *)params->context)->onRecv(); ((Node *)params->context)->onRecv();
// Node* c;
// c = static_cast<Node*>(params->context);
// c->onRecv();
break; break;
case SIM_TIMER: case SIM_TIMER:
((Simulation *)params->context)->timer(); ((Simulation *)params->context)->timer();
@ -224,8 +221,12 @@ void Simulation::p2pSimulation()
this->createThread("r1", NODE_RECV, &r1); this->createThread("r1", NODE_RECV, &r1);
this->createThread("r2", NODE_RECV, &r2); this->createThread("r2", NODE_RECV, &r2);
this->createThread("s1", NODE_RECV, &server); this->createThread("s1", NODE_RECV, &server);
this->createThread("p2", NODE_RECV, &peer2);
peer1.connectToServer("80.80.90.91", 6565); peer1.connectToServer("80.80.90.91", 6565);
sleep(1);
this->createThread("p1", NODE_RECV, &peer1);
while(1); while(1);
} }

Loading…
Cancel
Save