Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9542 in orxonox.OLD for branches/proxy/src


Ignore:
Timestamp:
Jul 28, 2006, 10:48:17 AM (18 years ago)
Author:
patrick
Message:

more generalized message handling now

Location:
branches/proxy/src/lib/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/message_manager.cc

    r9541 r9542  
    249249          recieverType == RT_NOT_USER && SharedNetworkData::getInstance()->getHostID() != destinationId ||
    250250          recieverType == RT_USER  && SharedNetworkData::getInstance()->getHostID() == destinationId ||
    251           recieverType == RT_SERVER && SharedNetworkData::getInstance()->isMasterServer())
     251          recieverType == RT_SERVER && SharedNetworkData::getInstance()->isMasterServer() ||
     252          recieverType == RT_SERVER && SharedNetworkData::getInstance()->isProxyServerActive())
    252253      {
    253254
     
    417418
    418419    // relay server special handling
    419     if( SharedNetworkData::getInstance()->isMasterServer() && SharedNetworkData::getInstance()->isUserProxyServerActive(it->first))
     420//     if( SharedNetworkData::getInstance()->isMasterServer() && SharedNetworkData::getInstance()->isUserProxyServerActive(it->first))
     421//     {
     422//       NetworkMessage msg;
     423//
     424//       msg.data = new byte[dataLength];
     425//       memcpy( msg.data, data, dataLength );
     426//       msg.length = dataLength;
     427//       msg.messageType = messageType;
     428//       msg.number = this->newNumber++;
     429//       msg.senderId = SharedNetworkData::getInstance()->getHostID();
     430//       msg.destinationId = reciever;
     431//       msg.recieverType = recieverType;
     432//       msg.priority = messagePriority;
     433//
     434//       it->second.messages.push_back( msg );
     435//     }
     436//     // proxy server to master server
     437//     else if( SharedNetworkData::getInstance()->isProxyServerActive() && SharedNetworkData::getInstance()->isUserMasterServer(it->first))
     438//     {
     439//       NetworkMessage msg;
     440//
     441//       msg.data = new byte[dataLength];
     442//       memcpy( msg.data, data, dataLength );
     443//       msg.length = dataLength;
     444//       msg.messageType = messageType;
     445//       msg.number = this->newNumber++;
     446//       msg.senderId = SharedNetworkData::getInstance()->getHostID();
     447//       msg.destinationId = reciever;
     448//       msg.recieverType = recieverType;
     449//       msg.priority = messagePriority;
     450//
     451//       it->second.messages.push_back( msg );
     452//     }
     453    // check for every node if the message is for it also
     454    /*else*/ if (
     455         recieverType == RT_ALL_ME ||
     456         recieverType == RT_ALL_BUT_ME ||
     457         recieverType == RT_USER && it->first == reciever ||
     458         recieverType == RT_NOT_USER && it->first != reciever ||
     459         recieverType == RT_SERVER && getNetworkStream()->isUserMasterServer( it->first ) ||
     460         recieverType == RT_SERVER && getNetworkStream()->isUserProxyServerActive( it->first )
     461       )
    420462    {
    421463      NetworkMessage msg;
     
    433475      it->second.messages.push_back( msg );
    434476    }
    435     // proxy server to master server
    436     else if( SharedNetworkData::getInstance()->isProxyServerActive() && SharedNetworkData::getInstance()->isUserMasterServer(it->first))
    437     {
    438       NetworkMessage msg;
    439 
    440       msg.data = new byte[dataLength];
    441       memcpy( msg.data, data, dataLength );
    442       msg.length = dataLength;
    443       msg.messageType = messageType;
    444       msg.number = this->newNumber++;
    445       msg.senderId = SharedNetworkData::getInstance()->getHostID();
    446       msg.destinationId = reciever;
    447       msg.recieverType = recieverType;
    448       msg.priority = messagePriority;
    449 
    450       it->second.messages.push_back( msg );
    451     }
    452     // check for every node if the message is for it also
    453     else if (
    454          recieverType == RT_ALL_ME ||
    455          recieverType == RT_ALL_BUT_ME ||
    456          recieverType == RT_USER && it->first == reciever ||
    457          recieverType == RT_NOT_USER && it->first != reciever ||
    458          recieverType == RT_SERVER && getNetworkStream()->isUserMasterServer( it->first ) ||
    459          recieverType == RT_SERVER && getNetworkStream()->isUserProxyServerActive( it->first )
    460        )
    461     {
    462       NetworkMessage msg;
    463 
    464       msg.data = new byte[dataLength];
    465       memcpy( msg.data, data, dataLength );
    466       msg.length = dataLength;
    467       msg.messageType = messageType;
    468       msg.number = this->newNumber++;
    469       msg.senderId = SharedNetworkData::getInstance()->getHostID();
    470       msg.destinationId = reciever;
    471       msg.recieverType = recieverType;
    472       msg.priority = messagePriority;
    473 
    474       it->second.messages.push_back( msg );
    475     }
    476477
    477478
  • branches/proxy/src/lib/network/player_stats.cc

    r9541 r9542  
    163163  if ( this->playable && userId == SharedNetworkData::getInstance()->getHostID() )
    164164  {
    165     PRINTF(0)(">>>>>>>>>>>>>>>>>>>>>> assign playable %i to user %i (localuser)\n\n\n", this->playable->getUniqueID(), userId);
    166165    State::getPlayer()->setPlayable( this->playable );
    167166    // also set the team id
  • branches/proxy/src/lib/network/proxy/proxy_control.cc

    r9541 r9542  
    8787  assert( Converter::intToByteArray( userId, data + INTSIZE, INTSIZE ) == INTSIZE );
    8888
    89   MessageManager::getInstance()->sendMessage( MSGID_PROXY_NEWCLIENT, data, INTSIZE, RT_ALL_BUT_ME, NET_UNASSIGNED, MP_HIGHBANDWIDTH );
     89  MessageManager::getInstance()->sendMessage( MSGID_PROXY_NEWCLIENT, data, INTSIZE, RT_SERVER, NET_UNASSIGNED, MP_HIGHBANDWIDTH );
    9090}
    9191
     
    104104bool ProxyControl::messageHandlerNewClient( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId  )
    105105{
     106  PRINTF(0)("\n\nulla\n\n");
    106107  int userId;
    107108  // body data length correct?
Note: See TracChangeset for help on using the changeset viewer.