Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5798 in orxonox.OLD for branches


Ignore:
Timestamp:
Nov 27, 2005, 5:52:32 PM (19 years ago)
Author:
patrick
Message:

network: testing env. got segfault in the code

Location:
branches/network/src
Files:
7 edited

Legend:

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

    r5749 r5798  
    128128void ConnectionMonitor::displayStatistic()
    129129{
    130   PRINT(0)("============================================\n");
    131   PRINT(0)("Connection Monitor Network Statistics:\n");
    132   PRINT(0)("Total received packets:",totalReceivedPackets);
    133   PRINT(0)("Average datarate :\n",averageDatarate);
    134   PRINT(0)("Total lost packets:",totalLostPackets);
    135   PRINT(0)("Packetloss [%] :\n",totalPacketloss);
    136 
    137   PRINT(0)("Current datarate :\n",currentDatarate);
    138   PRINT(0)("Delays of the last few packets :\n");
    139   for(int i=1 ;i <= packetToAverage-1;i++)
    140     PRINT(0)("%i ",lastFewDelays[i]);
    141 
    142   PRINT(0)("============================================\n");
     130//   PRINT(0)("============================================\n");
     131//   PRINT(0)("Connection Monitor Network Statistics:\n");
     132//   PRINT(0)("Total received packets:",totalReceivedPackets);
     133//   PRINT(0)("Average datarate :\n",averageDatarate);
     134//   PRINT(0)("Total lost packets:",totalLostPackets);
     135//   PRINT(0)("Packetloss [%] :\n",totalPacketloss);
     136//
     137//   PRINT(0)("Current datarate :\n",currentDatarate);
     138//   PRINT(0)("Delays of the last few packets :\n");
     139//   for(int i=1 ;i <= packetToAverage-1;i++)
     140//     PRINT(0)("%i ",lastFewDelays[i]);
     141//
     142//   PRINT(0)("============================================\n");
    143143
    144144}
  • branches/network/src/lib/network/network_manager.cc

    r5649 r5798  
    167167    while( stream)
    168168    {
     169      printf("NetworkManager::synchronize ");
     170      if(stream->isServer()) printf("Server\n"); else printf("Client\n");
    169171      stream->processData();
    170172      stream = (NetworkStream*)(iterator->nextElement());
  • branches/network/src/lib/network/network_socket.cc

    r5752 r5798  
    218218  memcpy(outgoingBuffer + outgoingBufferLength, data, nbytes);
    219219  outgoingBufferLength += nbytes;
    220 
     220 
    221221  SDL_mutexV(outgoingBufferMutex);
    222222
  • branches/network/src/lib/network/network_stream.cc

    r5747 r5798  
    121121
    122122  /* first of all read  data from networkSocket*/
    123   while(ret == 0)
    124123  ret = this->networkSocket->readBlock((byte*)upBuffer, PACKAGE_SIZE + sizeof(Header));
    125124  /* error checking: data read? */
  • branches/network/src/lib/network/network_stream.h

    r5741 r5798  
    2626  void init();
    2727 
     28  inline bool isServer() { return (this->type == NET_SERVER)? true:false; }
    2829  virtual void processData();
    2930
     
    3536   Synchronizeable*         synchronizeables;
    3637   NetworkSocket* networkSocket;
     38   int                    type;
    3739};
    3840#endif /* _NETWORK_STREAM */
  • branches/network/src/subprojects/network/network_unit_test.cc

    r5747 r5798  
    144144
    145145  /* synchronize the data 1 time (increment for longer tests) */
    146   for( int i = 0; i < 1; i++) {
     146  for( int i = 0; i < 3; i++) {
    147147    nm->synchronize();
    148148  }
    149149
     150  printf("Test finished\n");
     151 
     152 
    150153  /* delete the network manager again */
    151154  delete nm;
  • branches/network/src/subprojects/network/simple_sync.cc

    r5650 r5798  
    3131{
    3232  this->outLength = 10;
    33   this->inLength = 0;
     33  this->inLength = 40;
    3434  this->outData = new byte[this->outLength];
     35  this->inData = new byte[this->inLength];
    3536 
    3637  for( int i = 0; i < this->outLength; i++)
     
    4849
    4950/**
    50  *  write data to NetworkStream
     51 *  write data to Synchronizeable
    5152 */
    5253void SimpleSync::writeBytes(byte* data, int length)
    5354{
     55  if(this->inLength < length)
     56    PRINTF(0)("ERROR: local buffer is smaller than the data to receive.\n");
    5457  /* copy the data localy */
    55   this->inLength = length;
    56   for(int i = 0; i < length; i++)
     58  for( int i = 0; i < this->inLength; i++)
    5759  {
    5860    this->inData[i] = data[i];
     
    6466
    6567/**
    66  *  read data from NetworkStream
     68 *  read data from Synchronizeable
    6769 */
    6870int SimpleSync::readBytes(byte* data)
     
    7981{
    8082  PRINTF(0)("Write in: |");
    81   for(int i = 0; i < inLength; i++)
     83  for(int i = 0; i < this->inLength; i++)
    8284  {
    8385    PRINT(0)(" %i ",this->inData[i]);
     
    8991{
    9092  PRINTF(0)("Read out: |");
    91   for(int i = 0; i < outLength; i++)
     93  for(int i = 0; i < this->outLength; i++)
    9294  {
    9395    PRINT(0)(" %i ",this->outData[i]);
Note: See TracChangeset for help on using the changeset viewer.