Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2009, 9:20:57 PM (15 years ago)
Author:
landauf
Message:

merged netp3 branch back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/network/ConnectionManager.cc

    r2896 r3084  
    5858{
    5959  bool operator< (ENetAddress a, ENetAddress b) {
    60     if(a.host <= b.host)
    61       return true;
    62     else
    63       return false;
     60    return a.host <= b.host;
    6461  }
    6562}
     
    7572    assert(instance_==0);
    7673    instance_=this;
    77     quit=false;
     74    quit_=false;
    7875    bindAddress = new ENetAddress();
    7976    bindAddress->host = ENET_HOST_ANY;
     
    8481    assert(instance_==0);
    8582    instance_=this;
    86     quit=false;
     83    quit_=false;
    8784    bindAddress = new ENetAddress();
    8885    bindAddress->host = ENET_HOST_ANY;
     
    9390    assert(instance_==0);
    9491    instance_=this;
    95     quit=false;
     92    quit_=false;
    9693    bindAddress = new ENetAddress();
    9794    enet_address_set_host (bindAddress, address.c_str());
     
    10299    assert(instance_==0);
    103100    instance_=this;
    104     quit=false;
     101    quit_=false;
    105102    bindAddress = new ENetAddress();
    106103    enet_address_set_host (bindAddress, address);
     
    109106
    110107  ConnectionManager::~ConnectionManager(){
    111     if(!quit)
     108    if(!quit_)
    112109      quitListener();
    113110    instance_=0;
     
    133130
    134131  bool ConnectionManager::quitListener() {
    135     quit=true;
     132    quit_=true;
    136133    receiverThread_->join();
    137134    return true;
     
    189186    if(server==NULL){
    190187      // add some error handling here ==========================
    191       quit=true;
     188      quit_=true;
    192189      return;
    193190    }
    194191
    195192    event = new ENetEvent;
    196     while(!quit){
     193    while(!quit_)
     194    {
    197195      { //mutex scope
    198196        boost::recursive_mutex::scoped_lock lock(enet_mutex_g);
    199197        if(enet_host_service(server, event, NETWORK_WAIT_TIMEOUT)<0){
    200198          // we should never reach this point
    201           quit=true;
     199          printf("ConnectionManager: ENet returned with an error\n");
     200          quit_=true;
     201          printf("waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhh\n");
    202202          continue;
    203203          // add some error handling here ========================
     
    208208        // log handling ================
    209209        case ENET_EVENT_TYPE_CONNECT:
     210//             printf("====================================================================");
    210211        case ENET_EVENT_TYPE_DISCONNECT:
    211212        case ENET_EVENT_TYPE_RECEIVE:
     
    215216        case ENET_EVENT_TYPE_NONE:
    216217          //receiverThread_->yield();
    217           msleep(1);
     218          msleep(10);
    218219          break;
    219220      }
     
    267268  }
    268269
    269   bool ConnectionManager::processData(ENetEvent *event) {
    270     // just add packet to the buffer
    271     // this can be extended with some preprocessing
    272     return buffer.push(event);
    273   }
    274 
    275 
    276270
    277271  int ConnectionManager::getClientID(ENetPeer* peer) {
Note: See TracChangeset for help on using the changeset viewer.