Changeset 1517 for code/branches
- Timestamp:
- Jun 2, 2008, 2:42:46 PM (16 years ago)
- Location:
- code/branches/network/src/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/ClientConnection.cc
r1515 r1517 107 107 //network_threads.create_thread(boost::bind(boost::mem_fn(&ClientConnection::receiverThread), this)); 108 108 // wait 10 seconds for the connection to be established 109 return waitEstablished( 3000);109 return waitEstablished(NETWORK_CLIENT_CONNECT_TIMEOUT); 110 110 } 111 111 … … 169 169 { 170 170 boost::recursive_mutex::scoped_lock lock(enet_mutex_); 171 if(enet_host_service(client, event, NETWORK_CLIENT_ TIMEOUT)<0){171 if(enet_host_service(client, event, NETWORK_CLIENT_WAIT_TIME)<0){ 172 172 // we should never reach this point 173 173 quit=true; … … 211 211 boost::recursive_mutex::scoped_lock lock(enet_mutex_); 212 212 enet_peer_disconnect(server, 0); 213 while(enet_host_service(client, &event, NETWORK_CLIENT_ TIMEOUT) > 0){213 while(enet_host_service(client, &event, NETWORK_CLIENT_WAIT_TIME) > 0){ 214 214 switch (event.type) 215 215 { … … 238 238 } 239 239 // handshake 240 if(enet_host_service(client, &event, NETWORK_CLIENT_TIMEOUT)>=0 && event.type == ENET_EVENT_TYPE_CONNECT){241 established=true;242 returntrue;243 }244 else {245 COUT(2) << "ClientConnection: enet_host_service < 0 or event.type != ENET_EVENT_TYPE_CONNECT # EVENT:" << event.type << std::endl;246 return false;247 }240 while(enet_host_service(client, &event, NETWORK_CLIENT_WAIT_TIME)>=0 && !quit){ 241 if( event.type == ENET_EVENT_TYPE_CONNECT ){ 242 established=true; 243 return true; 244 } 245 } 246 COUT(2) << "ClientConnection: enet_host_service < 0 or event.type != ENET_EVENT_TYPE_CONNECT # EVENT:" << event.type << std::endl; 247 return false; 248 248 } 249 249 -
code/branches/network/src/network/ClientConnection.h
r1505 r1517 54 54 #define NETWORK_PORT 55556 55 55 #define NETWORK_CLIENT_MAX_CONNECTIONS 5 56 #define NETWORK_CLIENT_TIMEOUT 1 56 #define NETWORK_CLIENT_WAIT_TIME 1 57 #define NETWORK_CLIENT_CONNECT_TIMEOUT 3000 // miliseconds 57 58 #define NETWORK_CLIENT_CHANNELS 2 58 59
Note: See TracChangeset
for help on using the changeset viewer.