Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6039 in orxonox.OLD for branches/network


Ignore:
Timestamp:
Dec 11, 2005, 1:25:51 AM (19 years ago)
Author:
rennerc
Message:

network_socket wont cause a segfault on connection close

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

Legend:

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

    r6026 r6039  
    6464  outgoingBufferLength = 0;
    6565
    66 #ifdef _USE_OUTGOING_BUFFER
     66
    6767  thread_write_running = false;
    68 #endif
    6968  thread_read_running = false;
    7069
     
    106105  SDL_DestroyMutex(outgoingBufferMutex);
    107106  SDL_DestroyMutex(socketMutex);
     107  SDL_DestroyMutex(threadTerminationMutex);
    108108}
    109109
     
    263263  NetworkSocket * self = (NetworkSocket*)data;
    264264
     265  self->thread_read_running = true;
     266
    265267  while (!self->terminateThread)
    266268  {
     
    292294      SDL_mutexV(self->socketMutex);
    293295      SDL_mutexV(self->incomingBufferMutex);
    294       return -1;
     296      break;
    295297    }
    296298
     
    311313    delete self;
    312314  }
    313 
    314 
    315   printf("QUIT READ THREAD\n");
     315  else
     316  {
     317    SDL_mutexV(self->threadTerminationMutex);
     318  }
     319
     320
     321  PRINTF(0)("QUIT READ THREAD\n");
    316322  return 0;
    317323}
     
    323329  char buffer[_LOCAL_BUFFER_SIZE];
    324330  NetworkSocket * self = (NetworkSocket*)data;
     331
     332  self->thread_write_running = true;
    325333
    326334  while (!self->terminateThread)
     
    361369
    362370      SDL_mutexV(self->socketMutex);
    363       return -1;
     371      break;
    364372    }
    365373
     
    374382    delete self;
    375383  }
    376 
    377 
    378   printf("QUIT WRITE THREAD\n");
     384  else
     385  {
     386    SDL_mutexV(self->threadTerminationMutex);
     387  }
     388
     389
     390  PRINTF(0)("QUIT WRITE THREAD\n");
    379391  return 0;
    380392}
  • branches/network/src/lib/network/network_socket.h

    r6026 r6039  
    6666  static int thread_read(void * data);
    6767  bool thread_read_running;
     68  bool thread_write_running;
    6869#ifdef _USE_OUTGOING_BUFFER
    6970  static int thread_write(void * data);
    70   bool thread_write_running;
    7171#endif
    7272
  • branches/network/src/lib/network/network_stream.cc

    r6025 r6039  
    220220
    221221      //delete networkSockets[i];
     222      networkSockets[i]->disconnectServer();
    222223      networkSockets[i]->destroy();
    223224      networkSockets[i] = NULL;
Note: See TracChangeset for help on using the changeset viewer.