Skip to content

Commit

Permalink
retry once
Browse files Browse the repository at this point in the history
  • Loading branch information
lrouquette committed Nov 2, 2021
1 parent 0b1b235 commit d390a58
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/jaegertracing/utils/HTTPTransporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,17 @@ class HTTPTransporter : public Transport {
const auto numWritten = ::send(_socket.handle(), reinterpret_cast<char*>(data), sizeof(uint8_t) * size, 0);

if (static_cast<unsigned>(numWritten) != size) {
std::ostringstream oss;
oss << "Failed to write message, numWritten=" << numWritten << ", size=" << size;
throw std::system_error(errno, std::system_category(), oss.str());
// Reconnect and try again
_socket.close();
_socket.open(AF_INET, SOCK_STREAM);
_socket.connect(_serverAddr);

const auto numWrittenBis = ::send(_socket.handle(), reinterpret_cast<char*>(data), sizeof(uint8_t) * size, 0);
if (static_cast<unsigned>(numWrittenBis) != size) {
std::ostringstream oss;
oss << "Failed to write message, numWritten=" << numWrittenBis << ", size=" << size;
throw std::system_error(errno, std::system_category(), oss.str());
}
}

// Waits for response. Check that the server acknowledged
Expand Down

0 comments on commit d390a58

Please sign in to comment.