test smaller slices and longer time for weird BIO_do_connect error during build test

This commit is contained in:
John
2022-03-19 13:30:22 +01:00
parent d054968967
commit 7abcfadb1c
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -1382,7 +1382,7 @@ int main(int argc, char* argv[]) {
}
if (!lazyHttpClient()
|| !s_configHttpClient->connect(configHost, configPort, proto == "https", PACKAGE_NAME "/" PACKAGE_VERSION)) {
logError(lf_main, "invalid configPath URL");
logError(lf_main, "invalid configPath URL (connect)");
cleanup();
return EINVAL;
}
+3 -3
View File
@@ -46,7 +46,7 @@ using std::hex;
#endif
// the time slice to sleep between repeated SSL reads/writes
#define SLEEP_NANOS 50000
#define SLEEP_NANOS 20000
bool checkError(const char* call) {
unsigned long err = ERR_get_error();
@@ -149,7 +149,7 @@ SSLSocket* SSLSocket::connect(const string& host, const uint16_t& port, bool htt
ostringstream ostr;
ostr << host << ':' << static_cast<unsigned>(port);
const string hostPort = ostr.str();
time_t until = time(nullptr) + (timeout <= 2 ? 2 : timeout); // at least 2 seconds
time_t until = time(nullptr) + (timeout <= 3 ? 3 : timeout); // at least 3 seconds
if (!https) {
do {
bio = BIO_new_connect(hostPort.c_str());
@@ -207,7 +207,7 @@ SSLSocket* SSLSocket::connect(const string& host, const uint16_t& port, bool htt
break;
}
long res = BIO_do_connect(bio);
while (res != 1 && BIO_should_retry(bio) && time(nullptr) < until) {
while (res <= 0 && BIO_should_retry(bio) && time(nullptr) < until) {
usleep(SLEEP_NANOS);
res = BIO_do_connect(bio);
}