Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8329 for code/trunk


Ignore:
Timestamp:
Apr 26, 2011, 12:31:32 AM (14 years ago)
Author:
scheusso
Message:

preparing countermeasures against clients sending unwanted data

Location:
code/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/network/synchronisable/Synchronisable.cc

    r8327 r8329  
    236236      mode=state_;
    237237    //if this tick is we dont synchronise, then abort now
    238     if(!doSync(id, mode))
     238    if(!doSync(/*id,*/ mode))
    239239      return 0;
    240240    uint32_t tempsize = 0;
     
    302302    if(mode==0x0)
    303303      mode=state_;
     304   
    304305    if(syncList_.empty())
    305306    {
     
    313314    SynchronisableHeaderLight syncHeaderLight(mem);
    314315    assert(syncHeaderLight.getObjectID()==this->getObjectID());
     316   
     317    if( !this->doReceive(mode) )
     318    {
     319      uint32_t headerSize;
     320      if( syncHeaderLight.isDiffed() )
     321        headerSize = SynchronisableHeaderLight::getSize();
     322      else
     323        headerSize = SynchronisableHeader::getSize();
     324      mem += syncHeaderLight.getDataSize() + headerSize;
     325      return true;
     326    }
    315327
    316328    //COUT(5) << "Synchronisable: objectID_ " << syncHeader.getObjectID() << ", classID_ " << syncHeader.getClassID() << " size: " << syncHeader.getDataSize() << " synchronising data" << std::endl;
     
    357369    if (mode==0x0)
    358370      mode=state_;
    359     if (!doSync(id, mode))
     371    if (!doSync(/*id, */mode))
    360372      return 0;
    361373    assert( mode==state_ );
     
    375387   * @return true/false
    376388   */
    377   bool Synchronisable::doSync(int32_t id, uint8_t mode)
     389  bool Synchronisable::doSync(/*int32_t id,*/ uint8_t mode)
    378390  {
    379391//     if(mode==0x0)
     
    381393    assert(mode!=0x0);
    382394    return ( (this->objectMode_ & mode)!=0 && (!syncList_.empty() ) );
     395  }
     396 
     397  /**
     398   * This function determines, wheter the object should accept data from the bytestream (according to its syncmode/direction)
     399   * @param id gamestate id
     400   * @param mode Synchronisation mode (toclient, toserver or bidirectional)
     401   * @return true/false
     402   */
     403  bool Synchronisable::doReceive( uint8_t mode)
     404  {
     405    //return mode != this->objectMode_ || this->objectMode_ == ObjectDirection::Bidirectional;
     406    return true;
    383407  }
    384408
  • code/trunk/src/libraries/network/synchronisable/Synchronisable.h

    r8314 r8329  
    180180    uint32_t getSize(int32_t id, uint8_t mode=0x0);
    181181    bool updateData(uint8_t*& mem, uint8_t mode=0x0, bool forceCallback=false);
    182     bool doSync(int32_t id, uint8_t mode=0x0);
     182    bool doSync(/*int32_t id,*/ uint8_t mode=0x0);
     183    bool doReceive( uint8_t mode );
    183184
    184185    inline void setObjectID(uint32_t id){ this->objectID_ = id; objectMap_[this->objectID_] = this; }
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r7889 r8329  
    8989
    9090        this->isHumanShip_ = this->hasLocalController();
     91       
     92        this->setSyncMode(ObjectDirection::Bidirectional); // needed to synchronise e.g. aimposition
    9193    }
    9294
Note: See TracChangeset for help on using the changeset viewer.