Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9406 in orxonox.OLD for trunk/src/lib/network/network_stream.cc


Ignore:
Timestamp:
Jul 24, 2006, 11:09:47 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the proxy back

merged with commandsvn merge -r9346:HEAD https://svn.orxonox.net/orxonox/branches/proxy .

no conflicts

File:
1 edited

Legend:

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

    r9246 r9406  
    1212   main-programmer: Christoph Renner rennerc@ee.ethz.ch
    1313   co-programmer:   Patrick Boenzli  boenzlip@orxonox.ethz.ch
     14
     15     June 2006: finishing work on the network stream for pps presentation (rennerc@ee.ethz.ch)
     16     July 2006: some code rearangement and integration of the proxy server mechanism (boenzlip@ee.ethz.ch)
    1417*/
    1518
     
    2225#include "udp_socket.h"
    2326#include "udp_server_socket.h"
    24 #include "connection_monitor.h"
     27#include "monitor/connection_monitor.h"
     28#include "monitor/network_monitor.h"
    2529#include "synchronizeable.h"
     30#include "ip.h"
    2631#include "network_game_manager.h"
    2732#include "shared_network_data.h"
     
    4247#include <algorithm>
    4348
    44 /* include your own header */
     49
    4550#include "network_stream.h"
    4651
    47 /* probably unnecessary */
    48 using namespace std;
     52
     53#include "converter.h"
    4954
    5055
     
    5257
    5358
     59/**
     60 * empty constructor
     61 */
    5462NetworkStream::NetworkStream()
    5563    : DataStream()
     
    5765  this->init();
    5866  /* initialize the references */
    59   this->type = NET_CLIENT;
    60 }
    61 
    62 
    63 /**
    64  * connect to a server as a client
    65  *  @param host: host name (address)
    66  *  @param port: port number
    67  */
    68 NetworkStream::NetworkStream( std::string host, int port )
    69 {
    70   this->type = NET_CLIENT;
     67  this->pInfo->nodeType = NET_CLIENT;
     68}
     69
     70
     71NetworkStream::NetworkStream( int nodeType)
     72{
    7173  this->init();
    72   this->peers[0].socket = new UdpSocket( host, port );
    73   this->peers[0].userId = 0;
    74   this->peers[0].isServer = true;
    75   this->peers[0].connectionMonitor = new ConnectionMonitor( 0 );
    76 }
    77 
    78 
    79 /**
    80  * start as a server
    81  *  @param port: at this port
    82  */
    83 NetworkStream::NetworkStream( int port )
    84 {
    85   this->type = NET_SERVER;
    86   this->init();
    87   this->serverSocket = new UdpServerSocket(port);
    88   this->bActive = true;
    89 }
     74
     75  this->pInfo->nodeType = nodeType;
     76
     77  switch( nodeType)
     78  {
     79    case NET_MASTER_SERVER:
     80      // init the shared network data
     81      SharedNetworkData::getInstance()->setHostID(0);
     82//       SharedNetworkData::getInstance()->setNodeType(NET_MASTER_SERVER);
     83      break;
     84
     85    case NET_PROXY_SERVER_ACTIVE:
     86      // init the shared network data
     87      SharedNetworkData::getInstance()->setHostID(0);
     88//       SharedNetworkData::getInstance()->setNodeType(NET_PROXY_SERVER_ACTIVE);
     89      break;
     90    case NET_PROXY_SERVER_PASSIVE:
     91            // init the shared network data
     92      SharedNetworkData::getInstance()->setHostID(0);
     93//       SharedNetworkData::getInstance()->setNodeType(NET_PROXY_SERVER_PASSIVE);
     94      break;
     95    case NET_CLIENT:
     96//       SharedNetworkData::getInstance()->setNodeType(NET_CLIENT);
     97      break;
     98  }
     99
     100  SharedNetworkData::getInstance()->setDefaultSyncStream(this);
     101
     102  // get the local ip address
     103  IPaddress ip;
     104  SDLNet_ResolveHost( &ip, NULL, 0);
     105  this->pInfo->ip = ip;
     106}
     107
    90108
    91109
     
    97115  /* set the class id for the base object */
    98116  this->setClassID(CL_NETWORK_STREAM, "NetworkStream");
    99   this->bActive = false;
    100117  this->serverSocket = NULL;
    101118  this->networkGameManager = NULL;
    102   myHostId = 0;
    103   currentState = 0;
     119  this->networkMonitor = NULL;
     120
     121  this->pInfo = new PeerInfo();
     122  this->pInfo->userId = 0;
     123  this->pInfo->lastAckedState = 0;
     124  this->pInfo->lastRecvedState = 0;
     125
     126
     127  this->currentState = 0;
    104128
    105129  remainingBytesToWriteToDict = Preferences::getInstance()->getInt( "compression", "writedict", 0 );
     
    147171  for ( SynchronizeableList::const_iterator it = getSyncBegin(); it != getSyncEnd(); it ++ )
    148172    (*it)->setNetworkStream( NULL );
     173
     174  if( this->pInfo)
     175    delete this->pInfo;
     176
     177  if( this->networkMonitor)
     178    delete this->networkMonitor;
     179}
     180
     181
     182/**
     183 * establish a connection to a remote master server
     184 * @param host: host name
     185 * @param port: the port number
     186 */
     187void NetworkStream::connectToMasterServer(std::string host, int port)
     188{
     189  int node = this->peers.size();
     190  this->peers[node].socket = new UdpSocket( host, port );
     191  this->peers[node].userId = 0;
     192
     193  this->peers[node].nodeType = NET_MASTER_SERVER;
     194  this->peers[node].connectionMonitor = new ConnectionMonitor( 0 );
     195  this->peers[node].ip = this->peers[node].socket->getRemoteAddress();
     196}
     197
     198
     199/**
     200 * establish a connection to a remote proxy server
     201 * @param host: host name
     202 * @param port: the port number
     203 */
     204void NetworkStream::connectToProxyServer(std::string host, int port)
     205{
     206  int node = this->peers.size();
     207  this->peers[node].socket = new UdpSocket( host, port );
     208  this->peers[node].userId = 0;
     209
     210  this->peers[node].nodeType = NET_PROXY_SERVER_ACTIVE;
     211  this->peers[node].connectionMonitor = new ConnectionMonitor( 0 );
     212  this->peers[node].ip = this->peers[node].socket->getRemoteAddress();
     213}
     214
     215
     216/**
     217 * create a server
     218 * @param port: interface port for all clients
     219 */
     220void NetworkStream::createServer(int port)
     221{
     222  this->serverSocket = new UdpServerSocket(port);
    149223}
    150224
     
    156230{
    157231  this->networkGameManager = NetworkGameManager::getInstance();
    158   // setUniqueID( maxCon+2 ) because we need one id for every handshake
    159   // and one for handshake to reject client maxCon+1
     232
    160233  this->networkGameManager->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
    161234  MessageManager::getInstance()->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
     
    165238/**
    166239 * starts the network handshake
     240 * handsakes are always initialized from the client side first. this starts the handshake and therefore is only
     241 * executed as client
    167242 */
    168243void NetworkStream::startHandshake()
    169244{
    170   Handshake* hs = new Handshake(false);
     245  Handshake* hs = new Handshake(this->pInfo->nodeType);
    171246  hs->setUniqueID( 0 );
    172247  assert( peers[0].handshake == NULL );
    173248  peers[0].handshake = hs;
    174249
     250  // set the preferred nick name
    175251  hs->setPreferedNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Player" ) );
    176252
    177 //   peers[0].handshake->setSynchronized( true );
    178   //this->connectSynchronizeable(*hs);
    179   //this->connectSynchronizeable(*hs);
    180   PRINTF(0)("NetworkStream: Handshake created: %s\n", hs->getName());
     253  PRINTF(0)("NetworkStream: Handshake created: %s\n", hs->getCName());
    181254}
    182255
     
    192265  sync.setNetworkStream( this );
    193266
    194   this->bActive = true;
     267//   this->bActive = true;
    195268}
    196269
     
    215288void NetworkStream::processData()
    216289{
     290  // create the network monitor after all the init work and before there is any connection handlings
     291  if( this->networkMonitor == NULL)
     292    this->networkMonitor = new NetworkMonitor(this);
     293
     294
    217295  int tick = SDL_GetTicks();
    218296
    219   currentState++;
    220 
    221   if ( this->type == NET_SERVER )
    222   {
     297  this->currentState++;
     298  // there was a wrap around
     299  if( this->currentState < 0)
     300  {
     301    PRINTF(1)("A wrap around in the state variable as occured. The server was running so long? Pls restart server or write a mail to the supporters!\n");
     302  }
     303
     304  if ( this->pInfo->isMasterServer())
     305  {
     306    // execute everytthing the master server shoudl do
     307    if ( serverSocket )
     308      serverSocket->update();
     309
     310    this->updateConnectionList();
     311  }
     312  else if( this->pInfo->isProxyServer())
     313  {
     314    // execute everything the proxy server should do
    223315    if ( serverSocket )
    224316      serverSocket->update();
     
    249341  cleanUpOldSyncList();
    250342  handleHandshakes();
     343
     344  // update the network monitor
     345  this->networkMonitor->process();
    251346
    252347  // order of up/downstream is important!!!!
     
    258353
    259354/**
    260  * if we are a server update the connection list to accept new connections (clients)
    261  * also start the handsake for the new clients
     355 * if we are a NET_MASTER_SERVER or NET_PROXY_SERVER_ACTIVE update the connection list to accept new
     356 * connections (clients) also start the handsake for the new clients
    262357 */
    263358void NetworkStream::updateConnectionList( )
     
    276371      clientId = freeSocketSlots.back();
    277372      freeSocketSlots.pop_back();
    278       peers[clientId].socket = tempNetworkSocket;
    279       peers[clientId].handshake = new Handshake(true, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID() );
    280       peers[clientId].connectionMonitor = new ConnectionMonitor( clientId );
    281       peers[clientId].handshake->setUniqueID(clientId);
    282       peers[clientId].userId = clientId;
    283       peers[clientId].isServer = false;
    284373    }
    285374    else
     
    290379        if ( it->first >= clientId )
    291380          clientId = it->first + 1;
    292 
    293       peers[clientId].socket = tempNetworkSocket;
    294       peers[clientId].handshake = new Handshake(true, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID());
    295       peers[clientId].handshake->setUniqueID(clientId);
    296       peers[clientId].connectionMonitor = new ConnectionMonitor( clientId );
    297       peers[clientId].userId = clientId;
    298       peers[clientId].isServer = false;
    299 
    300       PRINTF(0)("num sync: %d\n", synchronizeables.size());
    301     }
    302 
    303     // check if there are too many clients connected
    304     if ( clientId > MAX_CONNECTIONS )
    305     {
    306       peers[clientId].handshake->doReject( "too many connections" );
    307       PRINTF(0)("Will reject client %d because there are to many connections!\n", clientId);
    308     }
    309     else
    310     {
    311       PRINTF(0)("New Client: %d\n", clientId);
    312     }
    313 
    314     //this->connectSynchronizeable(*handshakes[clientId]);
     381    }
     382    peers[clientId].socket = tempNetworkSocket;
     383
     384
     385    // create new handshake and init its variables
     386    peers[clientId].handshake = new Handshake(this->pInfo->nodeType, clientId, this->networkGameManager->getUniqueID(), MessageManager::getInstance()->getUniqueID());
     387    peers[clientId].handshake->setUniqueID(clientId);
     388
     389    peers[clientId].connectionMonitor = new ConnectionMonitor( clientId );
     390    peers[clientId].userId = clientId;
     391
     392    PRINTF(0)("num sync: %d\n", synchronizeables.size());
     393
     394    // get the proxy server informations and write them to the handshake, if any (proxy)
     395    assert( this->networkMonitor != NULL);
     396    PeerInfo* pi = this->networkMonitor->getFirstChoiceProxy();
     397    if( pi != NULL)
     398    {
     399      peers[clientId].handshake->setProxy1Address( pi->ip);
     400    }
     401    pi = this->networkMonitor->getSecondChoiceProxy();
     402    if( pi != NULL)
     403      peers[clientId].handshake->setProxy2Address( pi->ip);
     404
     405    // check if the connecting client should reconnect to a proxy server
     406    peers[clientId].handshake->setRedirect(/*this->networkMonitor->isReconnectNextClient()*/false);
     407
     408    // the connecting node of course is a client
     409    peers[clientId].nodeType = NET_CLIENT;
     410    peers[clientId].ip = peers[clientId].socket->getRemoteAddress();
     411
     412
     413    // check if there are too many clients connected (DEPRECATED: new: the masterserver sends a list of proxy servers)
     414//     if ( clientId > SharedNetworkData::getInstance()->getMaxPlayer() )
     415//     {
     416// //       peers[clientId].handshake->setRedirect(true);
     417// //
     418// //       peers[clientId].handshake->doReject( "too many connections" );
     419//       PRINTF(0)("Will reject client %d because there are to many connections!\n", clientId);
     420//     }
     421//     else
     422//     {
     423//       PRINTF(0)("New Client: %d\n", clientId);
     424//     }
     425    PRINTF(0)("New Client: %d\n", clientId);
     426
     427
    315428  }
    316429
     
    339452      it->second.socket = NULL;
    340453
     454      // remove the old connectin monitor
    341455      if ( it->second.connectionMonitor )
    342456        delete it->second.connectionMonitor;
    343457      it->second.connectionMonitor = NULL;
    344458
     459      // remove the handshake
    345460      if ( it->second.handshake )
    346461        delete it->second.handshake;
    347462      it->second.handshake = NULL;
    348463
     464      // and cleanup the user infos
    349465      for ( SynchronizeableList::iterator it2 = synchronizeables.begin(); it2 != synchronizeables.end(); it2++ )
    350466      {
     
    373489void NetworkStream::debug()
    374490{
    375   if( this->isServer())
    376     PRINT(0)(" Host ist Server with ID: %i\n", this->myHostId);
    377   else
    378     PRINT(0)(" Host ist Client with ID: %i\n", this->myHostId);
     491  if( SharedNetworkData::getInstance()->isMasterServer()) {
     492    PRINT(0)(" Host ist Master Server with ID: %i\n", this->pInfo->userId);
     493  }
     494  else if( SharedNetworkData::getInstance()->isProxyServer()) {
     495    PRINT(0)(" Host ist Proxy Server with ID: %i\n", this->pInfo->userId);
     496  }
     497  else {
     498    PRINT(0)(" Host ist Client with ID: %i\n", this->pInfo->userId);
     499  }
    379500
    380501  PRINT(0)(" Got %i connected Synchronizeables, showing active Syncs:\n", this->synchronizeables.size());
     
    382503  {
    383504    if( (*it)->beSynchronized() == true)
    384       PRINT(0)("  Synchronizeable of class: %s::%s, with unique ID: %i, Synchronize: %i\n", (*it)->getClassName(), (*it)->getName(),
     505      PRINT(0)("  Synchronizeable of class: %s::%s, with unique ID: %i, Synchronize: %i\n", (*it)->getClassCName(), (*it)->getCName(),
    385506               (*it)->getUniqueID(), (*it)->beSynchronized());
    386507  }
    387   PRINT(0)(" Maximal Connections: %i\n", MAX_CONNECTIONS );
     508  PRINT(0)(" Maximal Connections: %i\n", SharedNetworkData::getInstance()->getMaxPlayer() );
    388509
    389510}
     
    414535    if ( it->second.handshake )
    415536    {
     537      // handshake finished
    416538      if ( it->second.handshake->completed() )
    417539      {
     540        //handshake is correct
    418541        if ( it->second.handshake->ok() )
    419542        {
     543          // the server gave it free for deletion
    420544          if ( !it->second.handshake->allowDel() )
    421545          {
    422             if ( type != NET_SERVER )
     546
     547            if ( this->pInfo->isClient() )
    423548            {
    424549              SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() );
    425               myHostId = SharedNetworkData::getInstance()->getHostID();
    426 
     550              this->pInfo->userId = SharedNetworkData::getInstance()->getHostID();
     551
     552              it->second.nodeType = it->second.handshake->getRemoteNodeType();
     553              it->second.ip = it->second.socket->getRemoteAddress();
     554              // add the new server to the nodes list (it can be a NET_MASTER_SERVER or NET_PROXY_SERVER)
     555              this->networkMonitor->addNode(&it->second);
     556              // get proxy 1 address and add it
     557              this->networkMonitor->addNode(it->second.handshake->getProxy1Address(), NET_PROXY_SERVER_ACTIVE);
     558              // get proxy 2 address and add it
     559              this->networkMonitor->addNode(it->second.handshake->getProxy2Address(), NET_PROXY_SERVER_ACTIVE);
     560
     561              // now check if the server accepted the connection
     562              if( it->second.handshake->redirect())
     563                this->handleReconnect( it->second.userId);
     564
     565              // create the new network game manager and init it
    427566              this->networkGameManager = NetworkGameManager::getInstance();
    428567              this->networkGameManager->setUniqueID( it->second.handshake->getNetworkGameManagerId() );
     568              // init the new message manager
    429569              MessageManager::getInstance()->setUniqueID( it->second.handshake->getMessageManagerId() );
    430570            }
     
    432572
    433573            PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId());
    434 
    435574            it->second.handshake->del();
    436575          }
    437576          else
    438577          {
     578            // handshake finished registring new player
    439579            if ( it->second.handshake->canDel() )
    440580            {
    441               if ( type == NET_SERVER )
     581
     582              if ( this->pInfo->isMasterServer() )
    442583              {
    443                 handleNewClient( it->second.userId );
     584                it->second.nodeType = it->second.handshake->getRemoteNodeType();
     585                it->second.ip = it->second.socket->getRemoteAddress();
     586
     587                this->networkMonitor->addNode(&it->second);
     588
     589                this->handleNewClient( it->second.userId );
     590
     591                if ( PlayerStats::getStats( it->second.userId ) && it->second.handshake->getPreferedNickName() != "" )
     592                {
     593                  PlayerStats::getStats( it->second.userId )->setNickName( it->second.handshake->getPreferedNickName() );
     594                }
     595              }
     596              else if ( this->pInfo->isProxyServer() )
     597              {
     598                it->second.nodeType = it->second.handshake->getRemoteNodeType();
     599                it->second.ip = it->second.socket->getRemoteAddress();
     600
     601                this->networkMonitor->addNode(&it->second);
     602
     603                this->handleNewClient( it->second.userId );
    444604
    445605                if ( PlayerStats::getStats( it->second.userId ) && it->second.handshake->getPreferedNickName() != "" )
     
    468628
    469629/**
     630 * this functions handles a reconnect event received from the a NET_MASTER_SERVER or NET_PROXY_SERVER
     631 */
     632void NetworkStream::handleReconnect(int userId)
     633{
     634  PRINTF(0)("===============================================\n");
     635  PRINTF(0)("Client is redirected to the other proxy servers\n");
     636  PRINTF(0)("===============================================\n");
     637
     638  return;
     639
     640  PeerInfo* pInfo = &this->peers[userId];
     641
     642  // reject the server
     643  pInfo->handshake->doReject( "redirected to different server");
     644
     645  // flush the old synchronization states, since the numbering could be completely different
     646  pInfo->lastAckedState = 0;
     647  pInfo->lastRecvedState = 0;
     648  // not sure if this works as expected
     649  if( pInfo->handshake)
     650    delete pInfo->handshake;
     651
     652  // disconnect from the current server and reconnect to proxy server
     653  pInfo->socket->reconnectToServer( pInfo->handshake->getProxy1Address().ipString(), pInfo->handshake->getProxy1Address().port());
     654
     655  // and restart the handshake
     656  this->startHandshake();
     657}
     658
     659
     660/**
    470661 * handle upstream network traffic
    471662 */
     
    501692    for ( SynchronizeableList::iterator it = synchronizeables.begin(); it != synchronizeables.end(); it++ )
    502693    {
     694
    503695      int oldOffset = offset;
    504696      Synchronizeable & sync = **it;
     697
    505698
    506699      // do not include synchronizeables with uninit id and syncs that don't want to be synchronized
     
    512705        continue;
    513706
    514       // if we are a server and this is not our handshake
    515       if ( isServer() && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
     707      // if we are a server (both master and proxy servers) and this is not our handshake
     708      if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
    516709        continue;
    517710
     
    521714        continue;
    522715
     716
     717      assert( sync.getLeafClassID() != 0);
     718
    523719      assert( offset + INTSIZE <= UDP_PACKET_SIZE );
    524720
    525721      // server fakes uniqueid == 0 for handshake
    526       if ( this->isServer() && sync.getUniqueID() < MAX_CONNECTIONS - 1 )
     722      if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer() ) &&
     723             sync.getUniqueID() <= SharedNetworkData::getInstance()->getMaxPlayer() + 1) // plus one to handle one client more than the max to redirect it
    527724        n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset );
    528725      else
    529726        n = Converter::intToByteArray( sync.getUniqueID(), buf + offset, UDP_PACKET_SIZE - offset );
    530727
     728
    531729      assert( n == INTSIZE );
    532730      offset += n;
    533731
    534       // make space for size
     732      // make space for packet size
    535733      offset += INTSIZE;
    536734
     
    573771    // now compress the data with the zip library
    574772    int compLength = 0;
    575     if ( this->isServer() )
     773    if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServer())
    576774      compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer );
    577775    else
     
    637835      assert( Converter::byteArrayToInt( buf + 2*INTSIZE, &fromState ) == INTSIZE );
    638836      assert( Converter::byteArrayToInt( buf + 3*INTSIZE, &ackedState ) == INTSIZE );
    639       //NETPRINTF(n)("ackedstate: %d\n", ackedState);
    640837      offset = 4*INTSIZE;
    641838
    642839      peer->second.connectionMonitor->processUnzippedIncomingPacket( tick, buf, packetLength, state, ackedState );
    643840
    644       //NETPRINTF(n)("got packet: %d, %d\n", length, packetLength);
    645 
    646     //if this is an old state drop it
     841
     842      //if this is an old state drop it
    647843      if ( state <= peer->second.lastRecvedState )
    648844        continue;
     
    655851      }
    656852
    657       while ( offset + 2*INTSIZE < length )
     853      while ( offset + 2 * INTSIZE < length )
    658854      {
    659855        assert( offset > 0 );
     
    669865        Synchronizeable * sync = NULL;
    670866
     867        // look for the synchronizeable in question
    671868        for ( SynchronizeableList::iterator it = synchronizeables.begin(); it != synchronizeables.end(); it++ )
    672869        {
    673         //                                        client thinks his handshake has id 0!!!!!
     870          // client thinks his handshake has id 0!!!!!
    674871          if ( (*it)->getUniqueID() == uniqueId || ( uniqueId == 0 && (*it)->getUniqueID() == peer->second.userId ) )
    675872          {
     
    679876        }
    680877
     878        // this synchronizeable does not yet exist! create it
    681879        if ( sync == NULL )
    682880        {
    683881          PRINTF(0)("could not find sync with id %d. try to create it\n", uniqueId);
     882
     883          // if it is an old synchronizeable already removed, ignore it
    684884          if ( oldSynchronizeables.find( uniqueId ) != oldSynchronizeables.end() )
    685885          {
     
    688888          }
    689889
    690           if ( !peers[peer->second.userId].isServer )
     890          // if the node we got this unknown sync from is a client we ignore it (since it has no rights to create a new sync)
     891          if ( peers[peer->second.userId].isClient() )
    691892          {
    692893            offset += syncDataLength;
     
    705906          assert( leafClassId != 0 );
    706907
     908
    707909          BaseObject * b = NULL;
    708910          /* These are some small exeptions in creation: Not all objects can/should be created via Factory */
     
    710912          if( leafClassId == CL_NULL_PARENT || leafClassId == CL_SYNCHRONIZEABLE || leafClassId == CL_NETWORK_GAME_MANAGER )
    711913          {
    712             PRINTF(1)("Can not create Class with ID %x!\n", (int)leafClassId);
     914            PRINTF(1)("Don't create Object with ID %x, ignored!\n", (int)leafClassId);
    713915            offset += syncDataLength;
    714916            continue;
     
    730932            sync->setSynchronized(true);
    731933
    732             PRINTF(0)("Fabricated %s with id %d\n", sync->getClassName(), sync->getUniqueID());
     934            PRINTF(0)("Fabricated %s with id %d\n", sync->getClassCName(), sync->getUniqueID());
    733935          }
    734936          else
     
    744946        int n = sync->setStateDiff( peer->second.userId, buf+offset, syncDataLength, state, fromState );
    745947        offset += n;
    746         //NETPRINTF(0)("SSSSSEEEEETTTTT: %s %d\n",sync->getClassName(), n);
    747948
    748949      }
     
    779980/**
    780981 * is executed when a handshake has finished
    781  * @todo create playable for new user
    782982 */
    783983void NetworkStream::handleNewClient( int userId )
    784984{
     985  // init and assign the message manager
    785986  MessageManager::getInstance()->initUser( userId );
    786 
     987  // do all game relevant stuff here
    787988  networkGameManager->signalNewPlayer( userId );
    788989}
     990
    789991
    790992/**
Note: See TracChangeset for help on using the changeset viewer.