Skip to content

Commit

Permalink
Correct timeout check
Browse files Browse the repository at this point in the history
  • Loading branch information
Smjert committed Oct 19, 2024
1 parent 737cc1e commit 24fdb5f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions osquery/remote/tests/test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,18 @@ bool TLSServerRunner::start(const std::string& server_cert,
// in establishing a correct TLS connection,
// but we assume that if it's not a connection timeout (TCP),
// then the server is ready enough.

if (!status.ok()) {
LOG(WARNING) << "Failed to ping: " << status.getMessage();
}

if (!status.ok() &&
status.getMessage().find("timeout") != std::string::npos) {
LOG(WARNING) << "Python HTTP Server not ready yet";
sleepFor(1000);
++retry;
continue;
if (status.getMessage().find("Operation timed out") !=
std::string::npos) {
LOG(WARNING) << "Python HTTP Server not ready yet";
sleepFor(1000);
++retry;
continue;
} else {
// We still log this error to see what was the issue,
// but in theory the server is ready to serve.
LOG(WARNING) << "Failed to ping: " << status.getMessage();
}
}

ready_to_serve = true;
Expand Down

0 comments on commit 24fdb5f

Please sign in to comment.