Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6062 in orxonox.OLD


Ignore:
Timestamp:
Dec 12, 2005, 2:25:31 PM (18 years ago)
Author:
rennerc
Message:

network_stream: server doesnt crash on connection close :D

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

Legend:

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

    r6053 r6062  
    3838void Handshake::writeBytes( const byte * data, int length )
    3939{
    40   PRINTF(0)("Handshake::writeBytes states = %d %d %d %d (%d)\n", hasState( HS_RECVD_INIT ), hasState( HS_RECVD_VER ), hasState( HS_RECVD_HID ), hasState( HS_COMPLETED ), state);
     40  PRINTF(5)("Handshake::writeBytes states = %d %d %d %d (%d)\n", hasState( HS_RECVD_INIT ), hasState( HS_RECVD_VER ), hasState( HS_RECVD_HID ), hasState( HS_COMPLETED ), state);
    4141
    4242  if ( hasState( HS_COMPLETED ) )
     
    8686  }
    8787
    88   if ( hasState( HS_RECVD_VER ) && !hasState( HS_RECVD_HID ) )
     88  if ( !isServer() && hasState( HS_RECVD_VER ) && !hasState( HS_RECVD_HID ) )
    8989  {
    9090    if ( length != 4 )
     
    107107int Handshake::readBytes( byte * data, int maxLength, int * reciever )
    108108{
    109   PRINTF(0)("Handshake::readBytes states = %d %d %d %d (%d)\n", hasState( HS_SENT_INIT ), hasState( HS_SENT_VER ), hasState( HS_SENT_HID ), hasState( HS_COMPLETED ), state);
     109  PRINTF(5)("Handshake::readBytes states = %d %d %d %d (%d)\n", hasState( HS_SENT_INIT ), hasState( HS_SENT_VER ), hasState( HS_SENT_HID ), hasState( HS_COMPLETED ), state);
    110110
    111111  if ( hasState( HS_COMPLETED ) )
  • branches/network/src/lib/network/network_socket.cc

    r6041 r6062  
    159159int NetworkSocket::writeBytes(byte * data, int length)
    160160{
    161   PRINTF(0)("NetworkSocket::writeBytes()\n");
     161  PRINTF(5)("NetworkSocket::writeBytes()\n");
    162162#ifdef _USE_OUTGOING_BUFFER
    163163
     
    207207int NetworkSocket::readBytes(byte * data, int length)
    208208{
    209   PRINTF(0)("NetworkSocket::readBytes()\n");
     209  PRINTF(5)("NetworkSocket::readBytes()\n");
    210210  if (data==NULL)
    211211    return 0;
     
    311311  {
    312312    SDL_mutexV(self->threadTerminationMutex);
    313     delete self;
    314313  }
    315314  else
     
    380379  {
    381380    SDL_mutexV(self->threadTerminationMutex);
    382     delete self;
    383381  }
    384382  else
     
    394392bool NetworkSocket::writePacket( byte * data, int length )
    395393{
    396   PRINTF(0)("NetworkSocket::writePacket()\n");
     394  PRINTF(5)("NetworkSocket::writePacket()\n");
    397395  if (length>255)
    398396  {
     
    409407int NetworkSocket::readPacket( byte * data, int maxLength )
    410408{
    411   PRINTF(0)("NetworkSocket::readPacket()\n");
     409  PRINTF(5)("NetworkSocket::readPacket()\n");
    412410  if (incomingBufferLength<1)
    413411  {
  • branches/network/src/lib/network/network_stream.cc

    r6060 r6062  
    122122{
    123123  this->synchronizeables.push_back(&sync);
     124  sync.setNetworkStream( this );
    124125
    125126  if( this->networkSockets.size()>0 )
     
    155156          }
    156157          PRINT(0)("handshake finished\n");
     158          delete handshakes[i];
     159          handshakes[i] = NULL;
    157160          //TODO: replace handshake by entitymanager
    158161        }
     
    176179  {
    177180    //TODO: remove items from synchronizeables if they dont exist
    178     if ( (*it)!=NULL  && ClassList::exists(*it) && (*it)->getOwner() == myHostId )
     181    if ( (*it)!=NULL && (*it)->getOwner() == myHostId )
    179182    {
    180183      do {
     
    197200          if ( networkSockets[reciever] != NULL )
    198201          {
    199             PRINTF(0)("write %d bytes to socket %d\n", dataLength, reciever);
     202            PRINTF(5)("write %d bytes to socket %d\n", dataLength, reciever);
    200203            networkSockets[reciever]->writePacket(downBuffer, dataLength);
    201204          }
     
    211214            if ( networkSockets[i] != NULL )
    212215            {
    213               PRINTF(0)("write %d bytes to socket %d\n", dataLength, reciever);
     216              PRINTF(5)("write %d bytes to socket %d\n", dataLength, reciever);
    214217              networkSockets[i]->writePacket(downBuffer, dataLength);
    215218            }
     
    366369      networkSockets[i] = NULL;
    367370      //TODO: delete handshake from synchronizeable list so i can delete it
    368       delete handshakes[i];
     371      if ( handshakes[i] )
     372        delete handshakes[i];
    369373      handshakes[i] = NULL;
    370374
Note: See TracChangeset for help on using the changeset viewer.