Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7614 in orxonox.OLD for branches/network


Ignore:
Timestamp:
May 13, 2006, 6:11:22 PM (19 years ago)
Author:
rennerc
Message:

fixed some bugs - handshake works now

Location:
branches/network/src
Files:
5 edited

Legend:

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

    r7613 r7614  
    465465
    466466          PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId());
    467           assert(false);
    468467
    469468          delete it->second.handshake;
     
    474473          PRINT(1)("handshake failed!\n");
    475474          it->second.socket->disconnectServer();
    476           assert(false);
    477475        }
    478476      }
     
    521519     
    522520      if ( isServer() && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
     521        continue;
     522     
     523      //do not sync null parent
     524      if ( sync.getLeafClassID() == CL_NULL_PARENT )
    523525        continue;
    524526
     
    535537      //make space for size
    536538      offset += INTSIZE;
    537      
     539
    538540      n = sync.getStateDiff( peer->second.userId, buf + offset, UDP_PACKET_SIZE-offset, currentState, peer->second.lastAckedState, 0 );
    539541      offset += n;
    540542     
    541       assert( Converter::intToByteArray( n, buf + offset - n, INTSIZE ) == INTSIZE );
     543      assert( Converter::intToByteArray( n, buf + offset - n - INTSIZE, INTSIZE ) == INTSIZE );
    542544    }
    543545   
     
    545547   
    546548    assert( peer->second.socket->writePacket( buf, offset ) );
    547     PRINTF(0)("send packet: %d userId = %d %x %d\n", offset, peer->second.userId, peer->second.handshake->getLeafClassID(), peer->second.handshake->getUniqueID());
    548     assert( peer->second.handshake->getLeafClassID() == CL_HANDSHAKE );
     549    PRINTF(0)("send packet: %d userId = %d\n", offset, peer->second.userId);
    549550  }
    550551}
     
    568569  for ( PeerList::iterator peer = peers.begin(); peer != peers.end(); peer++ )
    569570  {
     571   
    570572    if ( !peer->second.socket )
    571573      continue;
     
    598600      continue;
    599601    }
    600    
     602
    601603    while ( offset < length )
    602604    {
     
    666668        }
    667669      }
     670
    668671      offset += sync->setStateDiff( peer->second.userId, buf+offset, length-offset, state, fromState );
    669672    }
     
    676679    peer->second.lastAckedState = ackedState;
    677680  }
    678 }
    679 
    680 
    681 
    682 
    683 
    684 
     681 
     682}
     683
     684
     685
     686
     687
     688
  • branches/network/src/lib/network/synchronizeable.cc

    r7602 r7614  
    285285  else
    286286    stateFrom = (*it);
    287 
     287 
    288288  std::list<int> changes;
    289289 
     
    302302  //add state to state history
    303303  recvStates[userId].push_back( stateTo );
    304 
     304 
    305305  int i = 0;
    306306
     
    309309    i += (*it)->readFromBuf( stateTo->data + i, stateTo->dataLength - i );
    310310  }
    311  
     311
    312312  this->varChangeHandler( changes );
    313313 
     
    322322void Synchronizeable::varChangeHandler( std::list<int> & id )
    323323{
    324   for ( std::list<int>::iterator it = id.begin(); it != id.end(); it++ )
    325     assert( *it != mLeafClassId );
    326324}
    327325
  • branches/network/src/lib/network/synchronizeable_var/synchronizeable_quaternion.cc

    r7578 r7614  
    8383  int n = 0;
    8484
    85   res += Converter::byteArrayToFloat( buf + n, &x );
     85  res = Converter::byteArrayToFloat( buf + n, &x );
    8686  assert( res > 0 );
    8787  n += res;
    8888
    89   res += Converter::byteArrayToFloat( buf + n, &y );
     89  res = Converter::byteArrayToFloat( buf + n, &y );
    9090  assert( res > 0 );
    9191  n += res;
    9292
    93   res += Converter::byteArrayToFloat( buf + n, &z );
     93  res = Converter::byteArrayToFloat( buf + n, &z );
    9494  assert( res > 0 );
    9595  n += res;
    9696
    97   res += Converter::byteArrayToFloat( buf + n, &w );
     97  res = Converter::byteArrayToFloat( buf + n, &w );
    9898  assert( res > 0 );
    9999  n += res;
     
    101101  *vPtrOut = Quaternion( Vector(x, y, z), w );
    102102
    103   assert( res == 4*FLOATSIZE );
    104   return res;
     103  assert( n == 4*FLOATSIZE );
     104  return n;
    105105}
    106106
  • branches/network/src/lib/network/synchronizeable_var/synchronizeable_vector.cc

    r7578 r7614  
    8080  int n = 0;
    8181
    82   res += Converter::byteArrayToFloat( buf + n, &x );
     82  res = Converter::byteArrayToFloat( buf + n, &x );
    8383  assert( res > 0 );
    8484  n += res;
    8585
    86   res += Converter::byteArrayToFloat( buf + n, &y );
     86  res = Converter::byteArrayToFloat( buf + n, &y );
    8787  assert( res > 0 );
    8888  n += res;
    8989
    90   res += Converter::byteArrayToFloat( buf + n, &z );
     90  res = Converter::byteArrayToFloat( buf + n, &z );
    9191  assert( res > 0 );
    9292  n += res;
     
    9494  *vPtrOut = Vector( x, y, z );
    9595
    96   assert( res == 3*FLOATSIZE );
    97   return res;
     96  assert( n == 3*FLOATSIZE );
     97  return n;
    9898}
    9999
  • branches/network/src/subprojects/network/simple_sync.cc

    r7613 r7614  
    3131  : Synchronizeable()
    3232{
     33  setName( name );
    3334  in = 0;
    3435  out = 1;
Note: See TracChangeset for help on using the changeset viewer.