Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7602 in orxonox.OLD for branches/network/src/lib


Ignore:
Timestamp:
May 12, 2006, 9:08:48 AM (19 years ago)
Author:
rennerc
Message:

fixed some bugs

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

Legend:

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

    r7591 r7602  
    3434  this->localState.networkManagerId = networkGameManagerId;
    3535 
    36   orxId_handler = registerVarId( new SynchronizeableInt( &localState.orxId, &remoteState.orxId, "orxonoxId" ) );
    37   version_handler = registerVarId( new SynchronizeableInt( &localState.version, &remoteState.version, "version" ) );
    38   netManId_handler = registerVarId( new SynchronizeableInt( &localState.networkManagerId, &remoteState.networkManagerId, "networkManagerId" ) );
    39   hostId_handler = registerVarId( new SynchronizeableInt( &localState.hostId, &remoteState.hostId, "hostId" ) );
    40   completed_handler = registerVarId( new SynchronizeableInt( &localState.completed, &remoteState.completed, "completed" ) );
    41   error_handler = registerVarId( new SynchronizeableInt( &localState.error, &remoteState.error, "error" ) );
    42   errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString" ) );
     36  orxId_handler = registerVarId( new SynchronizeableInt( &localState.orxId, &remoteState.orxId, "orxonoxId", PERMISSION_ALL ) );
     37  version_handler = registerVarId( new SynchronizeableInt( &localState.version, &remoteState.version, "version", PERMISSION_ALL ) );
     38  netManId_handler = registerVarId( new SynchronizeableInt( &localState.networkManagerId, &remoteState.networkManagerId, "networkManagerId", PERMISSION_ALL ) );
     39  hostId_handler = registerVarId( new SynchronizeableInt( &localState.hostId, &remoteState.hostId, "hostId", PERMISSION_ALL ) );
     40  completed_handler = registerVarId( new SynchronizeableInt( &localState.completed, &remoteState.completed, "completed", PERMISSION_ALL ) );
     41  error_handler = registerVarId( new SynchronizeableInt( &localState.error, &remoteState.error, "error", PERMISSION_ALL ) );
     42  errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString", PERMISSION_ALL ) );
    4343 
    4444  localState.completed = false;
  • branches/network/src/lib/network/network_stream.cc

    r7591 r7602  
    163163  if (disconnectSynchro != this->synchronizeables.end())
    164164    this->synchronizeables.erase(disconnectSynchro);
    165 
    166   this->bActive = false;
     165 
     166  //TODO set timestamp
     167  oldSynchronizeables[sync.getUniqueID()] = 0;
    167168}
    168169
     
    462463
    463464          PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId());
    464 
     465          assert(false);
    465466
    466467          delete it->second.handshake;
     
    471472          PRINT(1)("handshake failed!\n");
    472473          it->second.socket->disconnectServer();
     474          assert(false);
    473475        }
    474476      }
     
    529531      offset += n;
    530532     
    531       offset += sync.getStateDiff( peer->second.userId, buf + offset, UDP_PACKET_SIZE-offset, currentState, peer->second.lastAckedState, 0 );
     533      //make space for size
     534      offset += INTSIZE;
     535     
     536      n = sync.getStateDiff( peer->second.userId, buf + offset, UDP_PACKET_SIZE-offset, currentState, peer->second.lastAckedState, 0 );
     537      offset += n;
     538     
     539      assert( Converter::intToByteArray( n, buf + offset - n, INTSIZE ) == INTSIZE );
    532540    }
    533541   
     
    535543   
    536544    assert( peer->second.socket->writePacket( buf, offset ) );
    537     PRINTF(0)("send packet: %d\n", offset);
     545    PRINTF(0)("send packet: %d userId = %d %x %d\n", offset, peer->second.userId, peer->second.handshake->getLeafClassID(), peer->second.handshake->getUniqueID());
     546    assert( peer->second.handshake->getLeafClassID() == CL_HANDSHAKE );
    538547  }
    539548}
     
    553562  int ackedState = 0;
    554563  int fromState = 0;
     564  int syncDataLength = 0;
    555565 
    556566  for ( PeerList::iterator peer = peers.begin(); peer != peers.end(); peer++ )
     
    592602      offset += INTSIZE;
    593603     
     604      assert( Converter::byteArrayToInt( buf + offset, &syncDataLength ) == INTSIZE );
     605      offset += INTSIZE;
     606     
    594607      Synchronizeable * sync = NULL;
    595608     
     
    606619      if ( sync == NULL )
    607620      {
     621        if ( oldSynchronizeables.find( uniqueId ) != oldSynchronizeables.end() )
     622        {
     623          offset += syncDataLength;
     624          continue;
     625        }
     626       
    608627        //TODO dont accept new object from all peers (probably only servers)
    609628        int leafClassId;
  • branches/network/src/lib/network/network_stream.h

    r7575 r7602  
    9898
    9999    NetworkGameManager*        networkGameManager;
     100
     101    std::map<int,int>          oldSynchronizeables;
    100102};
    101103#endif /* _NETWORK_STREAM */
  • branches/network/src/lib/network/synchronizeable.cc

    r7591 r7602  
    5252  /* make sure loadClassId is first synced var because this is read by networkStream */
    5353  assert( syncVarList.size() == 0 );
    54   this->registerVar( new SynchronizeableInt( (int*)&this->getLeafClassID(), (int*)&this->getLeafClassID(), "leafClassId" ) );
     54  mLeafClassId = this->registerVarId( new SynchronizeableInt( (int*)&this->getLeafClassID(), (int*)&this->getLeafClassID(), "leafClassId" ) );
    5555   
    5656  this->registerVar( new SynchronizeableInt( &this->owner, &this->owner, "owner" ) );
     
    189189      for ( int j = 0; j < (*it)->getSize(); it++ )
    190190      {
     191        assert(false);
    191192        stateTo->data[i] = 0;
    192193        i++;
     
    321322void Synchronizeable::varChangeHandler( std::list<int> & id )
    322323{
     324  for ( std::list<int>::iterator it = id.begin(); it != id.end(); it++ )
     325    assert( *it != mLeafClassId );
    323326}
    324327
     
    345348
    346349
     350
Note: See TracChangeset for help on using the changeset viewer.