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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/ConnectedSocket.cpp

    r15 r238  
    3232  char buffer[sizeof(uint16_t)];
    3333  size_t alreadyReceived = 0;
    34   Time remainingTimeout = timeout; // ms
     34  Time remainingTimeout = timeout; // ns
    3535  do {
    3636    Time beforeTime = GetTime(); // ns
     
    3838        RecvMessage(buffer + alreadyReceived,
    3939                    sizeof(uint16_t) - alreadyReceived, remainingTimeout);
    40     remainingTimeout -= (GetTime() - beforeTime) / 100000;
    41     if ((received < 0) || (remainingTimeout < 0))
    42       throw std::runtime_error("Timeout");
     40    remainingTimeout -= GetTime() - beforeTime;
     41    if ((received < 0) || (remainingTimeout < 0)) throw std::runtime_error("Timeout");
    4342    alreadyReceived += received;
    4443  } while (alreadyReceived != sizeof(uint16_t));
     
    5251  char *buffer = (char *)&dataInNetworkEndianness;
    5352  size_t alreadySent = 0;
    54   Time remainingTimeout = timeout; // ms
     53  Time remainingTimeout = timeout; // ns
    5554  do {
    5655    Time beforeTime = GetTime(); // ns
    5756    ssize_t sent = SendMessage(
    5857        buffer + alreadySent, sizeof(uint16_t) - alreadySent, remainingTimeout);
    59     remainingTimeout -= (GetTime() - beforeTime) / 100000;
     58    remainingTimeout -= GetTime() - beforeTime;
    6059    if ((sent < 0) || (remainingTimeout < 0))
    6160      throw std::runtime_error("Timeout");
     
    6766  char buffer[sizeof(uint32_t)];
    6867  size_t alreadyReceived = 0;
    69   Time remainingTimeout = timeout; // ms
     68  Time remainingTimeout = timeout; // ns
    7069  do {
    7170    Time beforeTime = GetTime(); // ns
     
    7372        RecvMessage(buffer + alreadyReceived,
    7473                    sizeof(uint32_t) - alreadyReceived, remainingTimeout);
    75     remainingTimeout -= (GetTime() - beforeTime) / 100000;
     74    remainingTimeout -= GetTime() - beforeTime;
    7675    if ((received < 0) || (remainingTimeout < 0))
    7776      throw std::runtime_error("Timeout");
     
    8786  char *buffer = (char *)&dataInNetworkEndianness;
    8887  size_t alreadySent = 0;
    89   Time remainingTimeout = timeout; // ms
     88  Time remainingTimeout = timeout; // ns
    9089  do {
    9190    Time beforeTime = GetTime(); // ns
    9291    ssize_t sent = SendMessage(
    9392        buffer + alreadySent, sizeof(uint32_t) - alreadySent, remainingTimeout);
    94     remainingTimeout -= (GetTime() - beforeTime) / 100000;
     93    remainingTimeout -= GetTime() - beforeTime;
    9594    if ((sent < 0) || (remainingTimeout < 0))
    9695      throw std::runtime_error("Timeout");
     
    108107        RecvMessage(buffer + alreadyReceived, stringSize - alreadyReceived,
    109108                    remainingTimeout);
    110     remainingTimeout -= (GetTime() - beforeTime) / 100000;
     109    remainingTimeout -= GetTime() - beforeTime;
    111110    if ((received < 0) || (remainingTimeout < 0))
    112111      throw std::runtime_error("Timeout");
Note: See TracChangeset for help on using the changeset viewer.