Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7591 in orxonox.OLD for branches/network/src


Ignore:
Timestamp:
May 11, 2006, 8:05:17 AM (19 years ago)
Author:
rennerc
Message:

fixed some bugs

Location:
branches/network/src/lib/network
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/handshake.cc

    r7565 r7591  
    7979        return;
    8080      }
     81      else
     82        localState.completed = true;
    8183    }
    8284     
     
    9092        return;
    9193      }
     94      else
     95        localState.completed = true;
    9296    }
    9397   
  • branches/network/src/lib/network/handshake.h

    r7565 r7591  
    3434    inline bool       completed(){ return localState.completed != 0 && remoteState.completed != 0; }
    3535    inline bool       ok(){ return localState.error == 0 && remoteState.error == 0; }
    36     inline int        getHostId(){ return localState.hostId; }
    37     inline int        getNetworkGameManagerId(){ return localState.networkManagerId; }
    38     inline void       doReject( std::string reason ){ remoteState.error = 1; remoteState.errorString = "the server rejected your connection ["+ reason +"]"; }
     36    inline int        getHostId(){ return remoteState.hostId; }
     37    inline int        getNetworkGameManagerId(){ return remoteState.networkManagerId; }
     38    inline void       doReject( std::string reason ){ localState.error = 1; localState.errorString = "the server rejected your connection ["+ reason +"]"; }
    3939   
    4040    virtual void varChangeHandler( std::list<int> & id );
  • branches/network/src/lib/network/network_stream.cc

    r7578 r7591  
    142142  peers[0].handshake = hs;
    143143//   peers[0].handshake->setSynchronized( true );
    144   this->connectSynchronizeable(*hs);
     144  //this->connectSynchronizeable(*hs);
    145145  //this->connectSynchronizeable(*hs);
    146146  PRINTF(0)("NetworkStream: Handshake created: %s\n", hs->getName());
     
    508508    {
    509509      Synchronizeable & sync = **it;
    510 
     510     
    511511      if ( !sync.beSynchronized() || sync.getUniqueID() < 0 )
    512512        continue;
     
    515515      if ( peer->second.handshake && sync.getLeafClassID() != CL_HANDSHAKE )
    516516        continue;
    517 
    518       PRINTF(0)("syncing: id:%d name:%s\n", sync.getUniqueID(), sync.getClassName());
    519      
     517     
     518      if ( isServer() && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
     519        continue;
     520
    520521      assert( offset + INTSIZE <= UDP_PACKET_SIZE );
    521522     
     
    644645        }
    645646      }
    646      
    647647      offset += sync->setStateDiff( peer->second.userId, buf+offset, length-offset, state, fromState );
    648648    }
  • branches/network/src/lib/network/synchronizeable.cc

    r7578 r7591  
    126126  while ( it != sentStates[userId].end() && (*it)->stateId < fromStateId )
    127127    it++;
    128   ///FIXED: altered begin() -> end()
    129   if ( it != sentStates[userId].end() )
     128
     129  if ( it != sentStates[userId].begin() )
    130130  {
    131131    for ( StateHistory::iterator it2 = sentStates[userId].begin(); it2 != it; it2++ )
     
    209209
    210210  sentStates[userId].push_back( stateTo );
     211 
     212  assert( i == neededSize );
    211213
    212214  //write diff to data
     
    229231 * @param stateId id of current state
    230232 * @param fromStateId id of the base state id
    231  * @return true on success
     233 * @return number bytes read
    232234 * @todo check for permissions
    233235 */
    234 bool Synchronizeable::setStateDiff( int userId, byte* data, int length, int stateId, int fromStateId )
     236int Synchronizeable::setStateDiff( int userId, byte* data, int length, int stateId, int fromStateId )
    235237{
    236238  //make sure this user has his history
     
    309311  this->varChangeHandler( changes );
    310312 
    311   return length;
     313  return i;
    312314}
    313315
  • branches/network/src/lib/network/synchronizeable.h

    r7565 r7591  
    6363
    6464    int getStateDiff( int userId, byte* data, int maxLength, int stateId, int fromStateId, int priorityTH );
    65     bool setStateDiff( int userId, byte* data, int length, int stateId, int fromStateId );
     65    int setStateDiff( int userId, byte* data, int length, int stateId, int fromStateId );
    6666
    6767    void registerVar( SynchronizeableVar * var );
Note: See TracChangeset for help on using the changeset viewer.