Changeset 9570 in orxonox.OLD for branches/proxy/src/lib
- Timestamp:
- Jul 28, 2006, 3:21:22 PM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/message_manager.h
r9563 r9570 36 36 MSGID_RESPAWN, //!< respawn message 37 37 38 MSGID_PROXY_NEWCLIENT //!< informs the master server about a new client 38 MSGID_PROXY_NEWCLIENT, //!< informs the master server about a new client 39 MSGID_PROXY_LEAVECLIENT //!< informs the master and other proxy servers about a leaving client 39 40 }; 40 41 -
branches/proxy/src/lib/network/network_stream.cc
r9564 r9570 453 453 454 454 455 455 456 //check if connections are ok else remove them 456 457 for ( PeerList::iterator it = peers.begin(); it != peers.end(); ) … … 470 471 471 472 this->handleDisconnect( it->second.userId); 473 if( SharedNetworkData::getInstance()->isProxyServerActive()) 474 ProxyControl::getInstance()->signalLeaveClient(it->second.userId); 472 475 473 476 it++; -
branches/proxy/src/lib/network/proxy/proxy_control.cc
r9557 r9570 128 128 return true; 129 129 } 130 131 132 133 /** 134 * signals client disconnect 135 * @param userId userId of the old client 136 */ 137 void ProxyControl::signalLeaveClient(int userId) 138 { 139 PRINTF(0)("Signaling new Client: %i\n", userId); 140 // make sure we are a proxy server 141 assert(SharedNetworkData::getInstance()->isProxyServerActive()); 142 143 byte data[INTSIZE]; 144 145 assert( Converter::intToByteArray( userId, data, INTSIZE ) == INTSIZE ); 146 147 MessageManager::getInstance()->sendMessage( MSGID_PROXY_LEAVECLIENT, data, INTSIZE, RT_SERVER, NET_UNASSIGNED, MP_HIGHBANDWIDTH ); 148 } 149 150 151 /** 152 * this is the handler for proxy signals: removing clients 153 * 154 * @param messageType the type of the message 155 * @param data message data 156 * @param dataLength length of the message data 157 * @param someData some other atteched data 158 * @param senderId id of the sender client 159 * @param destinationId id of the destination client 160 * @return true if succeeded 161 */ 162 bool ProxyControl::messageHandlerLeaveClient( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ) 163 { 164 // body data length correct? 165 if ( dataLength != INTSIZE ) 166 { 167 PRINTF(2)("leave client message has wrong size: %d\n", dataLength ); 168 return true; 169 } 170 // read the userId fromt he message body 171 int leaveClientId = 0; 172 assert( Converter::byteArrayToInt( data, &leaveClientId) == INTSIZE ); 173 174 PRINTF(0)("Got Signal: from %i new player left with userId: %i\n", senderId, leaveClientId); 175 // part for the master server 176 if( SharedNetworkData::getInstance()->isMasterServer()) 177 { 178 // we now create the new player ship and stuff... 179 NetworkGameManager::getInstance()->signalNewPlayer(leaveClientId); 180 } 181 else if(SharedNetworkData::getInstance()->isProxyServerActive()) 182 { 183 184 } 185 186 return true; 187 } -
branches/proxy/src/lib/network/proxy/proxy_control.h
r9538 r9570 31 31 static bool messageHandlerNewClient( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ); 32 32 33 void signalLeaveClient(int userId); 34 static bool messageHandlerLeaveClient( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId ); 35 33 36 34 37 private:
Note: See TracChangeset
for help on using the changeset viewer.