Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6026 in orxonox.OLD


Ignore:
Timestamp:
Dec 10, 2005, 9:57:51 PM (18 years ago)
Author:
rennerc
Message:

network_socket: should compile now

Location:
branches/network/src
Files:
3 edited

Legend:

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

    r6025 r6026  
    2727/* header for debug output */
    2828#include "debug.h"
    29 
    30 static SDL_mutex* threadTerminationMutex = SDL_CreateMutex();
    3129
    3230/**
     
    305303  }
    306304
    307   SDL_mutexP(threadTerminationMutex);
     305  SDL_mutexP(self->threadTerminationMutex);
    308306  self->thread_read_running = false;
    309307
    310308  if ( !self->thread_write_running )
     309  {
     310    SDL_mutexV(self->threadTerminationMutex);
    311311    delete self;
    312   SDL_mutexV(threadTerminationMutex);
     312  }
     313
    313314
    314315  printf("QUIT READ THREAD\n");
     
    365366  }
    366367
    367   SDL_mutexP(threadTerminationMutex);
     368  SDL_mutexP(self->threadTerminationMutex);
    368369  self->thread_write_running = false;
    369370
    370371  if ( !self->thread_read_running )
     372  {
     373    SDL_mutexV(self->threadTerminationMutex);
    371374    delete self;
    372   SDL_mutexV(threadTerminationMutex);
     375  }
     376
    373377
    374378  printf("QUIT WRITE THREAD\n");
  • branches/network/src/lib/network/network_socket.h

    r6025 r6026  
    6363  bool terminateThread;
    6464
    65   static SDL_mutex* threadTerminationMutex;
     65  SDL_mutex* threadTerminationMutex;
    6666  static int thread_read(void * data);
    6767  bool thread_read_running;
  • branches/network/src/subprojects/network/network_unit_test.cc

    r6025 r6026  
    4040  server.listen(9999);
    4141
    42   NetworkSocket client1(ip);
     42  NetworkSocket* client1 = new NetworkSocket(ip);
    4343
    4444  NetworkSocket* server1 = server.getNewSocket();
    4545
    46   NetworkSocket client2(ip);
     46  NetworkSocket* client2 = new NetworkSocket(ip);
    4747
    4848  NetworkSocket* server2 = server.getNewSocket();
     
    5151
    5252  printf("read from client1 before sending data\n");
    53   printf("result: %d bytes\n", client1.readPacket((byte*)buf, 1024));
     53  printf("result: %d bytes\n", client1->readPacket((byte*)buf, 1024));
    5454
    5555  printf("read from client2 before sending data\n");
    56   printf("result: %d bytes\n", client2.readPacket((byte*)buf, 1024));
     56  printf("result: %d bytes\n", client2->readPacket((byte*)buf, 1024));
    5757
    5858  int n;
     
    6161  char * str3 = "client2 to server";
    6262  char * str4 = "server2 to client";
    63   n = client1.writePacket((byte*)str1, strlen(str1)+1);
     63  n = client1->writePacket((byte*)str1, strlen(str1)+1);
    6464  printf("%d bytes send from client1\n", n);
    6565  n = server1->writePacket((byte*)str2, strlen(str2)+1);
    6666  printf("%d bytes send from server1\n", n);
    67   n = client2.writePacket((byte*)str3, strlen(str3)+1);
     67  n = client2->writePacket((byte*)str3, strlen(str3)+1);
    6868  printf("%d bytes send from client2\n", n);
    6969  n = server2->writePacket((byte*)str4, strlen(str4)+1);
     
    8888
    8989  printf("read from client1\n");
    90   n = client1.readPacket((byte*)buf, 1024);
     90  n = client1->readPacket((byte*)buf, 1024);
    9191  printf("read %d bytes\n", n);
    9292  if (n<0)
     
    9696
    9797  printf("read from client2\n");
    98   n = client2.readPacket((byte*)buf, 1024);
     98  n = client2->readPacket((byte*)buf, 1024);
    9999  printf("read %d bytes\n", n);
    100100  if (n<0)
     
    106106
    107107  printf("try to send more than 255 bytes\n");
    108   printf("result: %d\n", client1.writePacket((byte*)buf, 1000));
     108  printf("result: %d\n", client1->writePacket((byte*)buf, 1000));
    109109
    110110  server1->writePacket((byte*)str1, strlen(str1)+1);
    111111  SDL_Delay(500);
    112112  printf("try to read with a too small buffer\n");
    113   printf("result: %d\n", client1.readPacket((byte*)buf, strlen(str1)));
     113  printf("result: %d\n", client1->readPacket((byte*)buf, strlen(str1)));
    114114
    115115  return 0;
Note: See TracChangeset for help on using the changeset viewer.