Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6059 in orxonox.OLD for branches/network


Ignore:
Timestamp:
Dec 12, 2005, 1:24:38 PM (19 years ago)
Author:
rennerc
Message:
 
File:
1 edited

Legend:

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

    r6053 r6059  
    130130void NetworkStream::processData()
    131131{
    132   PRINTF(0)("processData()\n");
    133132  if ( this->type == NET_SERVER )
    134133    this->updateConnectionList();
     
    148147          }
    149148          PRINT(0)("handshake finished\n");
     149          //TODO: replace handshake by entitymanager
    150150        }
    151151        else
     
    167167  for (SynchronizeableList::iterator it = synchronizeables.begin(); it!=synchronizeables.end(); it++)
    168168  {
    169     if ( (*it) && (*it)->getOwner() == myHostId )
     169    //TODO: remove items from synchronizeables if they dont exist
     170    if ( (*it)!=NULL  && ClassList::exists(*it) && (*it)->getOwner() == myHostId )
    170171    {
    171172      do {
     
    173174        dataLength = (*it)->readBytes(downBuffer, DATA_STREAM_BUFFER_SIZE, &reciever);
    174175
    175         PRINTF(0)("reciever = %d\n", reciever);
    176176
    177177        if ( dataLength<=0 ){
     
    180180        }
    181181
    182         PRINTF(0)("read %d bytes\n", dataLength);
    183 
    184         if (ClassList::exists((*it)))
    185         {
    186           PRINTF(0)("before cast\n");
    187           dataLength = networkProtocol->createHeader((byte*)downBuffer, dataLength, DATA_STREAM_BUFFER_SIZE, static_cast<const Synchronizeable&>(*(*it)));
    188           PRINTF(0)("after cast\n");
    189         }
    190         else
    191         {
    192           PRINTF(0)("instance does not exist anymore\n");
    193           //synchronizeables.remove(it);
    194         }
     182        dataLength = networkProtocol->createHeader((byte*)downBuffer, dataLength, DATA_STREAM_BUFFER_SIZE, static_cast<const Synchronizeable&>(*(*it)));
    195183
    196184        if ( dataLength<=0 )
     
    199187        if ( reciever!=0 )
    200188        {
    201           if ( networkSockets[reciever] )
     189          if ( networkSockets[reciever] != NULL )
    202190          {
    203191            PRINTF(0)("write %d bytes to socket %d\n", dataLength, reciever);
     
    213201          for ( int i = 0; i<networkSockets.size(); i++)
    214202          {
    215             if ( networkSockets[i] )
     203            if ( networkSockets[i] != NULL )
    216204            {
    217205              PRINTF(0)("write %d bytes to socket %d\n", dataLength, reciever);
     
    222210
    223211      } while( reciever!=0 );
     212    }
     213    else
     214    {
     215      PRINTF(0)("synchronizeables == NULL");
    224216    }
    225217  }
     
    365357      networkSockets[i]->destroy();
    366358      networkSockets[i] = NULL;
     359      //TODO: delete handshake from synchronizeable list so i can delete it
    367360      delete handshakes[i];
    368361      handshakes[i] = NULL;
Note: See TracChangeset for help on using the changeset viewer.