Changeset 3084 for code/trunk/src/network/ConnectionManager.cc
- Timestamp:
- May 26, 2009, 9:20:57 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/network/ConnectionManager.cc
r2896 r3084 58 58 { 59 59 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; 64 61 } 65 62 } … … 75 72 assert(instance_==0); 76 73 instance_=this; 77 quit =false;74 quit_=false; 78 75 bindAddress = new ENetAddress(); 79 76 bindAddress->host = ENET_HOST_ANY; … … 84 81 assert(instance_==0); 85 82 instance_=this; 86 quit =false;83 quit_=false; 87 84 bindAddress = new ENetAddress(); 88 85 bindAddress->host = ENET_HOST_ANY; … … 93 90 assert(instance_==0); 94 91 instance_=this; 95 quit =false;92 quit_=false; 96 93 bindAddress = new ENetAddress(); 97 94 enet_address_set_host (bindAddress, address.c_str()); … … 102 99 assert(instance_==0); 103 100 instance_=this; 104 quit =false;101 quit_=false; 105 102 bindAddress = new ENetAddress(); 106 103 enet_address_set_host (bindAddress, address); … … 109 106 110 107 ConnectionManager::~ConnectionManager(){ 111 if(!quit )108 if(!quit_) 112 109 quitListener(); 113 110 instance_=0; … … 133 130 134 131 bool ConnectionManager::quitListener() { 135 quit =true;132 quit_=true; 136 133 receiverThread_->join(); 137 134 return true; … … 189 186 if(server==NULL){ 190 187 // add some error handling here ========================== 191 quit =true;188 quit_=true; 192 189 return; 193 190 } 194 191 195 192 event = new ENetEvent; 196 while(!quit){ 193 while(!quit_) 194 { 197 195 { //mutex scope 198 196 boost::recursive_mutex::scoped_lock lock(enet_mutex_g); 199 197 if(enet_host_service(server, event, NETWORK_WAIT_TIMEOUT)<0){ 200 198 // 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"); 202 202 continue; 203 203 // add some error handling here ======================== … … 208 208 // log handling ================ 209 209 case ENET_EVENT_TYPE_CONNECT: 210 // printf("===================================================================="); 210 211 case ENET_EVENT_TYPE_DISCONNECT: 211 212 case ENET_EVENT_TYPE_RECEIVE: … … 215 216 case ENET_EVENT_TYPE_NONE: 216 217 //receiverThread_->yield(); 217 msleep(1 );218 msleep(10); 218 219 break; 219 220 } … … 267 268 } 268 269 269 bool ConnectionManager::processData(ENetEvent *event) {270 // just add packet to the buffer271 // this can be extended with some preprocessing272 return buffer.push(event);273 }274 275 276 270 277 271 int ConnectionManager::getClientID(ENetPeer* peer) {
Note: See TracChangeset
for help on using the changeset viewer.