- Timestamp:
- Jul 25, 2006, 8:17:29 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/network_stream.cc
r9464 r9465 372 372 //check for new connections 373 373 374 NetworkSocket* tempNetworkSocket = this->clientSocket->getNewSocket();374 NetworkSocket* tempNetworkSocket = NULL; 375 375 int userId; 376 376 377 // we got new NET_CLIENT connecting 378 if ( tempNetworkSocket ) 379 { 380 // determine the network node id 381 if ( freeSocketSlots.size() > 0 ) 382 { 383 userId = freeSocketSlots.back(); 384 freeSocketSlots.pop_back(); 385 } 386 else 387 { 388 userId = 1; 389 390 for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ ) 391 if ( it->first >= userId ) 392 userId = it->first + 1; 393 } 394 // this creates a new entry in the peers list 395 peers[userId].socket = tempNetworkSocket; 396 this->handleConnect(userId); 397 398 PRINTF(0)("New Client: %d\n", userId); 399 } 400 401 tempNetworkSocket = this->proxySocket->getNewSocket(); 402 403 // we got new NET_PROXY_SERVER_ACTIVE connecting 404 if ( tempNetworkSocket ) 405 { 406 // determine the network node id 407 if ( freeSocketSlots.size() > 0 ) 408 { 409 userId = freeSocketSlots.back(); 410 freeSocketSlots.pop_back(); 411 } 412 else 413 { 414 userId = 1; 415 416 for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ ) 417 if ( it->first >= userId ) 418 userId = it->first + 1; 419 } 420 421 // this creates a new entry in the peers list 422 peers[userId].socket = tempNetworkSocket; 423 this->handleConnect(userId); 424 425 PRINTF(0)("New Proxy: %d\n", userId); 426 } 427 377 if( this->clientSocket != NULL) 378 { 379 tempNetworkSocket = this->clientSocket->getNewSocket(); 380 381 // we got new NET_CLIENT connecting 382 if ( tempNetworkSocket ) 383 { 384 // determine the network node id 385 if ( freeSocketSlots.size() > 0 ) 386 { 387 userId = freeSocketSlots.back(); 388 freeSocketSlots.pop_back(); 389 } 390 else 391 { 392 userId = 1; 393 394 for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ ) 395 if ( it->first >= userId ) 396 userId = it->first + 1; 397 } 398 // this creates a new entry in the peers list 399 peers[userId].socket = tempNetworkSocket; 400 this->handleConnect(userId); 401 402 PRINTF(0)("New Client: %d\n", userId); 403 } 404 } 405 406 407 if( this->proxySocket != NULL) 408 { 409 tempNetworkSocket = this->proxySocket->getNewSocket(); 410 411 // we got new NET_PROXY_SERVER_ACTIVE connecting 412 if ( tempNetworkSocket ) 413 { 414 // determine the network node id 415 if ( freeSocketSlots.size() > 0 ) 416 { 417 userId = freeSocketSlots.back(); 418 freeSocketSlots.pop_back(); 419 } 420 else 421 { 422 userId = 1; 423 424 for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ ) 425 if ( it->first >= userId ) 426 userId = it->first + 1; 427 } 428 429 // this creates a new entry in the peers list 430 peers[userId].socket = tempNetworkSocket; 431 this->handleConnect(userId); 432 433 PRINTF(0)("New Proxy: %d\n", userId); 434 } 435 } 428 436 429 437
Note: See TracChangeset
for help on using the changeset viewer.