Ignore:
Timestamp:
May 15, 2018, 4:41:02 PM (3 years ago)
Author:
Bayard Gildas
Message:

correction sémaphore. bloquant tout ça...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/TargetEthController.cpp

    r214 r238  
    5959    // socket to be closed by the client
    6060    controlSocket->RecvMessage(msg.buffer, msg.bufferSize);
     61    delete controlSocket;
    6162  }
    6263
     
    6566  SafeStop();
    6667  Join();
     68  delete dataSocket;
     69  delete listeningSocket;
    6770}
    6871
     
    202205
    203206bool TargetEthController::ProcessMessage(Message *msg) {
    204   return !(controlSocket->SendMessage(msg->buffer, msg->bufferSize, 0) < 0);
     207  return !(controlSocket->SendMessage(msg->buffer, msg->bufferSize, TIME_INFINITE) < 0);
    205208}
    206209
     
    234237  bool connectionAccepted = false;
    235238  while (!connectionAccepted) {
    236     controlSocket = listeningSocket->Accept(10);
    237     if (controlSocket == nullptr) {
    238       // Timeout (or error btw)
     239    try {
     240      controlSocket = listeningSocket->Accept(100000000);
     241    } catch (std::logic_error &e) {
     242      Thread::Err(e.what());
     243      return false;
     244    } catch (std::runtime_error e) {
     245      // timeout
    239246      if (ToBeStopped())
    240247        return false;
     248    }
     249    if (controlSocket == nullptr) {
     250      return false;
    241251    } else
    242252      connectionAccepted = true;
     
    248258  while (!axisNumberRead) {
    249259    try {
    250       axisNumber = controlSocket->ReadUInt32(10);
     260      axisNumber = controlSocket->ReadUInt32(100000000);
    251261      // Thread::Info("Debug: axisNumber %d\n", axisNumber);
    252262      axisNumberRead = true;
     
    260270  while (!bitsPerAxisRead) {
    261271    try {
    262       bitsPerAxis = controlSocket->ReadUInt32(10);
     272      bitsPerAxis = controlSocket->ReadUInt32(100000000);
    263273      // Thread::Info("Debug: bits per axis %d\n", bitsPerAxis);
    264274      bitsPerAxisRead = true;
     
    276286    while (!stringSizeRead) {
    277287      try {
    278         stringSize = controlSocket->ReadUInt32(10);
     288        stringSize = controlSocket->ReadUInt32(100000000);
    279289        stringSizeRead = true;
    280290      } catch (std::runtime_error e) {
     
    288298    while (!axisNameRead) {
    289299      try {
    290         axisName[i] = controlSocket->ReadString(stringSize, 10);
     300        axisName[i] = controlSocket->ReadString(stringSize, 100000000);
    291301        axisNameRead = true;
    292302      } catch (std::runtime_error e) {
     
    303313  while (!buttonNumberRead) {
    304314    try {
    305       buttonNumber = controlSocket->ReadUInt32(10);
     315      buttonNumber = controlSocket->ReadUInt32(100000000);
    306316      buttonNumberRead = true;
    307317    } catch (std::runtime_error e) {
     
    319329    while (!stringSizeRead) {
    320330      try {
    321         stringSize = controlSocket->ReadUInt32(10);
     331        stringSize = controlSocket->ReadUInt32(100000000);
    322332        stringSizeRead = true;
    323333      } catch (std::runtime_error e) {
     
    331341    while (!buttonNameRead) {
    332342      try {
    333         buttonName[i] = controlSocket->ReadString(stringSize, 10);
     343        buttonName[i] = controlSocket->ReadString(stringSize, 10000000);
    334344        buttonNameRead = true;
    335345      } catch (std::runtime_error e) {
Note: See TracChangeset for help on using the changeset viewer.