Changeset 3137 for code/branches
- Timestamp:
- Jun 10, 2009, 12:24:27 PM (15 years ago)
- Location:
- code/branches/netp4/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/netp4/src/network/Client.cc
r3084 r3137 169 169 bool b = packet->process(); 170 170 assert(b); 171 delete event; 171 172 } 172 173 if(gamestate.processGamestates()) -
code/branches/netp4/src/network/ClientConnection.cc
r3084 r3137 169 169 // assert(0); 170 170 printf("ClientConnection: ENet returned with an error!\n"); 171 quit_=true;172 break;171 // quit_=true; 172 continue; 173 173 // add some error handling here ======================== 174 174 } … … 197 197 } 198 198 } 199 delete event; 199 200 // now disconnect 200 201 201 202 if(!disconnectConnection()) 203 { 204 printf("could not disconnect properly\n"); 202 205 // if disconnecting failed destroy conn. 203 206 boost::recursive_mutex::scoped_lock lock(enet_mutex_g); 204 207 enet_peer_reset(server); 208 } 209 else 210 printf("properly disconnected\n"); 205 211 return; 206 212 } … … 221 227 break; 222 228 case ENET_EVENT_TYPE_DISCONNECT: 229 printf("received disconnect confirmation from server"); 223 230 return true; 224 231 } -
code/branches/netp4/src/network/ClientInformation.h
r2773 r3137 91 91 bool getSynched(); 92 92 93 94 93 private: 95 94 static ClientInformation *head_; -
code/branches/netp4/src/network/ConnectionManager.cc
r3093 r3137 132 132 quit_=true; 133 133 receiverThread_->join(); 134 delete receiverThread_; 134 135 return true; 135 136 } … … 206 207 // we should never reach this point 207 208 printf("ConnectionManager: ENet returned with an error\n"); 208 quit_=true;209 printf("waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhh\n");209 // quit_=true; 210 // printf("waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhh\n"); 210 211 continue; 211 212 // add some error handling here ======================== … … 218 219 // printf("===================================================================="); 219 220 case ENET_EVENT_TYPE_DISCONNECT: 221 // printf("===================================================================="); 220 222 case ENET_EVENT_TYPE_RECEIVE: 221 222 223 processData(event); 224 event = new ENetEvent; 223 225 break; 224 226 case ENET_EVENT_TYPE_NONE: 225 227 //receiverThread_->yield(); 226 msleep(1 0);228 msleep(1); 227 229 break; 228 230 } -
code/branches/netp4/src/network/ConnectionManager.h
r3093 r3137 55 55 const int NETWORK_PORT = 55556; 56 56 const int NETWORK_MAX_CONNECTIONS = 50; 57 const int NETWORK_WAIT_TIMEOUT = 1 0;57 const int NETWORK_WAIT_TIMEOUT = 1; 58 58 const int NETWORK_DEFAULT_CHANNEL = 0; 59 59 -
code/branches/netp4/src/network/GamestateManager.cc
r3120 r3137 63 63 GamestateManager::~GamestateManager() 64 64 { 65 if( this->reference ) 66 delete this->reference; 67 for( std::map<unsigned int, packet::Gamestate*>::iterator it = gamestateQueue.begin(); it != gamestateQueue.end(); it++ ) 68 delete (*it).second; 65 69 delete trafficControl_; 66 70 } -
code/branches/netp4/src/network/Server.cc
r3102 r3137 129 129 */ 130 130 void Server::close() { 131 ClientInformation *temp = ClientInformation::getBegin(); 132 ClientInformation *temp2; 133 // disconnect all connected clients 134 while( temp ) 135 { 136 temp2 = temp; 137 temp = temp->next(); 138 disconnectClient( temp2 ); 139 } 131 140 connection->quitListener(); 132 141 return; … … 199 208 switch( event->type ) { 200 209 case ENET_EVENT_TYPE_CONNECT: 201 COUT( 3) << "processing event_Type_connect" << std::endl;210 COUT(4) << "processing event_Type_connect" << std::endl; 202 211 addClient(event); 203 212 break; … … 305 314 // gs gets automatically deleted by enet callback 306 315 } 316 delete del; 307 317 return true; 308 318 } … … 382 392 if(!client) 383 393 return false; 394 else 395 disconnectClient( client ); 396 return true; 397 } 398 399 void Server::disconnectClient(int clientID){ 400 ClientInformation *client = ClientInformation::findClient(clientID); 401 if(client) 402 disconnectClient(client); 403 } 404 405 void Server::disconnectClient( ClientInformation *client){ 406 connection->disconnectClient(client); 384 407 gamestates_->removeClient(client); 385 386 408 // inform all the listeners 387 409 ObjectList<ClientConnectionListener>::iterator listener = ObjectList<ClientConnectionListener>::begin(); 388 410 while(listener){ 389 411 listener->clientDisconnected(client->getID()); 390 listener++; 391 } 392 393 return ClientInformation::removeClient(event->peer); 394 } 395 396 void Server::disconnectClient(int clientID){ 397 ClientInformation *client = ClientInformation::findClient(clientID); 398 if(client) 399 disconnectClient(client); 400 } 401 void Server::disconnectClient( ClientInformation *client){ 402 connection->disconnectClient(client); 403 gamestates_->removeClient(client); 412 ++listener; 413 } 414 delete client; //remove client from list 404 415 } 405 416 -
code/branches/netp4/src/network/TrafficControl.cc
r3132 r3137 137 137 void TrafficControl::ack(unsigned int clientID, unsigned int gamestateID) 138 138 { 139 if ( !this->bActive_ ) 140 return; 139 141 std::list<obj>::iterator itvec; // iterator to iterate through the acked objects 140 142 … … 227 229 { 228 230 229 //now the sorting 230 231 //compare listToProcess vs clientListPerm 232 //if listToProcess contains new Objects, add them to clientListPerm 233 std::list<obj>::iterator itvec; 231 if( bActive_ ) 232 { 233 //now the sorting 234 235 //compare listToProcess vs clientListPerm 236 //if listToProcess contains new Objects, add them to clientListPerm 237 std::list<obj>::iterator itvec; 234 238 235 std::map<unsigned int, objInfo >& objectListPerm = clientListPerm_[clientID];239 std::map<unsigned int, objInfo >& objectListPerm = clientListPerm_[clientID]; 236 240 237 238 239 240 {241 for( itvec=list.begin(); itvec != list.end(); itvec++) 242 { 243 if ( objectListPerm.find( (*itvec).objID) != objectListPerm.end() ) 244 { 241 245 // we already have the object in our map 242 246 //obj bleibt in liste und permanente prio wird berechnet 243 objectListPerm[(*itvec).objID].objDiffGS = currentGamestateID - objectListPerm[(*itvec).objID].objCurGS;244 continue;//check next objId245 }246 else247 {247 objectListPerm[(*itvec).objID].objDiffGS = currentGamestateID - objectListPerm[(*itvec).objID].objCurGS; 248 continue;//check next objId 249 } 250 else 251 { 248 252 // insert the object into clientListPerm 249 insertinClientListPerm(clientID,*itvec); 250 continue;//check next objId 251 } 252 } 253 //end compare listToProcess vs clientListPerm 254 255 if( bActive_ ) 256 { 253 insertinClientListPerm(clientID,*itvec); 254 continue;//check next objId 255 } 256 } 257 //end compare listToProcess vs clientListPerm 258 257 259 //sort copied list according to priorities 258 260 // use boost bind here because we need to pass a memberfunction to stl sort … … 275 277 // sort(list.begin(), list.end(), boost::bind(&TrafficControl::dataSort, this, _1, _2) ); 276 278 list.sort( boost::bind(&TrafficControl::dataSort, this, _1, _2) ); 279 280 //diese Funktion updateClientList muss noch gemacht werden 281 updateClientListTemp(list); 282 //end of sorting 277 283 } 278 //diese Funktion updateClientList muss noch gemacht werden279 updateClientListTemp(list);280 //end of sorting281 284 } 282 285 -
code/branches/netp4/src/network/packet/Gamestate.cc
r3120 r3137 80 80 Gamestate::~Gamestate() 81 81 { 82 if( header_ ) 83 delete header_; 82 84 } 83 85 … … 99 101 100 102 // create the header object 103 assert( header_ == 0 ); 101 104 header_ = new GamestateHeader(data_); 102 105 -
code/branches/netp4/src/network/synchronisable/Synchronisable.cc
r3135 r3137 98 98 // delete callback function objects 99 99 if(!Identifier::isCreatingHierarchy()){ 100 // remove object from the static objectMap 101 if (this->objectMode_ != 0x0 && (Host::running() && Host::isServer())) 102 deletedObjects_.push(objectID); 103 // delete all Synchronisable Variables from syncList ( which are also in stringList ) 100 104 for(std::vector<SynchronisableVariableBase*>::iterator it = syncList.begin(); it!=syncList.end(); it++) 101 105 delete (*it); 102 if (this->objectMode_ != 0x0 && (Host::running() && Host::isServer()))103 deletedObjects_.push(objectID);106 syncList.clear(); 107 stringList.clear(); 104 108 } 105 109 std::map<uint32_t, Synchronisable*>::iterator it; -
code/branches/netp4/src/orxonox/gamestates/GSDedicated.cc
r3126 r3137 163 163 break; 164 164 default: //not supported... 165 // std::cout << endl << c << endl; 165 166 break; 166 167 } … … 251 252 void GSDedicated::setTerminalMode() 252 253 { 254 #ifndef ORXONOX_PLATFORM_WINDOWS 253 255 termios new_settings; 254 256 … … 262 264 COUT(0) << endl; 263 265 // atexit(&GSDedicated::resetTerminalMode); 266 #endif 264 267 } 265 268
Note: See TracChangeset
for help on using the changeset viewer.