Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9562 in orxonox.OLD for branches/proxy/src/lib


Ignore:
Timestamp:
Jul 28, 2006, 12:42:36 PM (18 years ago)
Author:
patrick
Message:

message forwarding now with the real id of the sender

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

Legend:

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

    r9555 r9562  
    291291          msg.recieverType = (RecieverType)recieverType;
    292292
    293           this->sendMessage(msg.messageType, msg.data, msg.length, msg.recieverType, msg.destinationId, MP_HIGHBANDWIDTH);
     293          this->sendMessage(msg.messageType, msg.data, msg.length, msg.recieverType, msg.senderId = senderId, msg.destinationId, MP_HIGHBANDWIDTH);
    294294        }
    295295      }
     
    396396}
    397397
     398
     399
    398400/**
    399401 * send a message to one or more clients
     
    411413void MessageManager::sendMessage( MessageType messageType, byte * data, int dataLength, RecieverType recieverType, int reciever, MessagePriority messagePriority )
    412414{
     415  this->sendMessage(messageType, data, dataLength, recieverType, SharedNetworkData::getInstance()->getHostID(), reciever, messagePriority);
     416}
     417
     418
     419/**
     420 * send a message to one or more clients as a special client
     421 * recieverType:
     422 *               RT_ALL send to all users. reciever is ignored
     423 *               RT_USER send only to reciever
     424 *               RT_NOT_USER send to all but reciever
     425 *
     426 * @param messageType message id
     427 * @param data pointer to data
     428 * @param dataLength length of data
     429 * @param recieverType type of the receiver
     430 * @param sender the userId of the sender if there is need for shadowing it (eg. for msg forwarding)
     431 * @param reciever the userId of the receiver if needed (depends on the ReceiverType)
     432 */
     433    void MessageManager::sendMessage( MessageType messageType, byte * data, int dataLength, RecieverType recieverType, int sender, int reciever, MessagePriority messagePriority )
     434{
    413435  PRINTF(0)(" >>> MessageManager: sending msg with type: %i, recieverType: %i, reciever %i\n", messageType, recieverType, reciever);
    414436
     
    417439  {
    418440
    419     // relay server special handling
    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 (
     441    if (
    455442         recieverType == RT_ALL_ME ||
    456443         recieverType == RT_ALL_BUT_ME ||
     
    468455      msg.messageType = messageType;
    469456      msg.number = this->newNumber++;
    470       msg.senderId = SharedNetworkData::getInstance()->getHostID();
     457      msg.senderId = sender;
    471458      msg.destinationId = reciever;
    472459      msg.recieverType = recieverType;
     
    490477    msg.messageType = messageType;
    491478    msg.number = SharedNetworkData::getInstance()->getHostID();
    492     msg.senderId = SharedNetworkData::getInstance()->getHostID();
     479    msg.senderId = sender;
    493480    msg.destinationId = reciever;
    494481    msg.recieverType = recieverType;
  • branches/proxy/src/lib/network/message_manager.h

    r9538 r9562  
    103103
    104104   void sendMessage( MessageType messageType, byte * data, int dataLength, RecieverType recieverType, int reciever, MessagePriority messagePriority );
     105   void sendMessage( MessageType messageType, byte * data, int dataLength, RecieverType recieverType, int sender, int reciever, MessagePriority messagePriority );
    105106
    106107   void initUser( int userId );
Note: See TracChangeset for help on using the changeset viewer.