Changeset 9584 in orxonox.OLD for branches/proxy/src/lib/network/proxy
- Timestamp:
- Jul 28, 2006, 10:22:09 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/proxy/proxy_control.cc
r9583 r9584 18 18 19 19 20 #include "player.h"21 20 #include "state.h" 22 21 #include "shared_network_data.h" 23 22 #include "network_game_manager.h" 23 #include "ip.h" 24 #include "peer_info.h" 24 25 25 26 #include "converter.h" … … 77 78 /** 78 79 * signals new client connected to this local proxy 80 * 81 * byte 0 - 3 : userId 82 * byte 4 - 7 : ip address (IPaddress.host) 83 * 79 84 * @param userId userId of the new client 80 85 */ … … 90 95 // and the ip as an int 91 96 PeerInfo* pInfo = SharedNetworkData::getInstance()->getNetworkMonitor()->getPeerByUserId(userId); 92 assert( Converter::intToByteArray( userId, data, INTSIZE ) == INTSIZE ); 93 94 MessageManager::getInstance()->sendMessage( MSGID_PROXY_NEWCLIENT, data, INTSIZE, RT_SERVER, NET_UNASSIGNED, MP_HIGHBANDWIDTH ); 97 assert(pInfo != NULL); 98 assert( Converter::intToByteArray( pInfo->ip.host(), data + INTSIZE, INTSIZE ) == INTSIZE ); 99 100 MessageManager::getInstance()->sendMessage( MSGID_PROXY_NEWCLIENT, data, 2*INTSIZE, RT_SERVER, NET_UNASSIGNED, MP_HIGHBANDWIDTH ); 95 101 } 96 102 … … 118 124 int newClientId = 0; 119 125 assert( Converter::byteArrayToInt( data, &newClientId) == INTSIZE ); 126 // now read the ip address 127 int ipHost = 0; 128 assert( Converter::byteArrayToInt( data + INTSIZE, &ipHost) == INTSIZE ); 129 130 // register the new node at the network monitor 131 NetworkMonitor* netMon = SharedNetworkData::getInstance()->getNetworkMonitor(); 132 PeerInfo* pInfo = new PeerInfo(); 133 pInfo->bLocal = false; 134 pInfo->ip = IP(ipHost, 0); 135 pInfo->nodeType = NET_CLIENT; 136 netMon->addNode(pInfo); 120 137 121 138 PRINTF(0)("Got Signal: from %i new player arrived with userId: %i\n", senderId, newClientId);
Note: See TracChangeset
for help on using the changeset viewer.