Changeset 2171 for code/trunk/src/network/ConnectionManager.cc
- Timestamp:
- Nov 10, 2008, 12:05:03 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/objecthierarchy merged: 2111-2115,2123,2132-2134,2143-2144,2153-2158,2160-2169
- Property svn:mergeinfo changed
-
code/trunk/src/network/ConnectionManager.cc
r2087 r2171 65 65 } 66 66 67 namespace network67 namespace orxonox 68 68 { 69 69 //boost::thread_group network_threads; … … 138 138 139 139 bool ConnectionManager::addPacket(ENetPacket *packet, ENetPeer *peer) { 140 boost::recursive_mutex::scoped_lock lock( instance_->enet_mutex);140 boost::recursive_mutex::scoped_lock lock(ConnectionManager::enet_mutex); 141 141 if(enet_peer_send(peer, NETWORK_DEFAULT_CHANNEL, packet)!=0) 142 142 return false; … … 156 156 if(!instance_) 157 157 return false; 158 boost::recursive_mutex::scoped_lock lock( instance_->enet_mutex);158 boost::recursive_mutex::scoped_lock lock(ConnectionManager::enet_mutex); 159 159 for(ClientInformation *i=ClientInformation::getBegin()->next(); i!=0; i=i->next()){ 160 160 COUT(3) << "adding broadcast packet for client: " << i->getID() << std::endl; … … 169 169 if(server==NULL || !instance_) 170 170 return false; 171 boost::recursive_mutex::scoped_lock lock( enet_mutex);171 boost::recursive_mutex::scoped_lock lock(ConnectionManager::enet_mutex); 172 172 enet_host_flush(server); 173 173 lock.unlock(); … … 180 180 atexit(enet_deinitialize); 181 181 { //scope of the mutex 182 boost::recursive_mutex::scoped_lock lock( enet_mutex);182 boost::recursive_mutex::scoped_lock lock(ConnectionManager::enet_mutex); 183 183 enet_initialize(); 184 184 server = enet_host_create(&bindAddress, NETWORK_MAX_CONNECTIONS, 0, 0); … … 194 194 while(!quit){ 195 195 { //mutex scope 196 boost::recursive_mutex::scoped_lock lock( enet_mutex);196 boost::recursive_mutex::scoped_lock lock(ConnectionManager::enet_mutex); 197 197 if(enet_host_service(server, event, NETWORK_WAIT_TIMEOUT)<0){ 198 198 // we should never reach this point … … 236 236 // if we're finishied, destroy server 237 237 { 238 boost::recursive_mutex::scoped_lock lock( enet_mutex);238 boost::recursive_mutex::scoped_lock lock(ConnectionManager::enet_mutex); 239 239 enet_host_destroy(server); 240 240 lock.unlock(); … … 250 250 while(temp!=0){ 251 251 { 252 boost::recursive_mutex::scoped_lock lock( enet_mutex);252 boost::recursive_mutex::scoped_lock lock(ConnectionManager::enet_mutex); 253 253 enet_peer_disconnect(temp->getPeer(), 0); 254 254 lock.unlock(); … … 258 258 //bugfix: might be the reason why server crashes when clients disconnects 259 259 temp = ClientInformation::getBegin()->next(); 260 boost::recursive_mutex::scoped_lock lock( enet_mutex);260 boost::recursive_mutex::scoped_lock lock(ConnectionManager::enet_mutex); 261 261 while( temp!=0 && enet_host_service(server, &event, NETWORK_WAIT_TIMEOUT) >= 0){ 262 262 switch (event.type) … … 306 306 unsigned int network_id=0, failures=0; 307 307 std::string classname; 308 orxonox::Identifier *id;309 std::map<std::string, orxonox::Identifier*>::const_iterator it = orxonox::Factory::getFactoryMapBegin();310 while(it != orxonox::Factory::getFactoryMapEnd()){308 Identifier *id; 309 std::map<std::string, Identifier*>::const_iterator it = Factory::getFactoryMapBegin(); 310 while(it != Factory::getFactoryMapEnd()){ 311 311 id = (*it).second; 312 312 if(id == NULL) … … 332 332 void ConnectionManager::disconnectClient(ClientInformation *client){ 333 333 { 334 boost::recursive_mutex::scoped_lock lock( enet_mutex);334 boost::recursive_mutex::scoped_lock lock(ConnectionManager::enet_mutex); 335 335 enet_peer_disconnect(client->getPeer(), 0); 336 336 lock.unlock();
Note: See TracChangeset
for help on using the changeset viewer.