Skip to content

Commit 721b83a

Browse files
authored
Retry only when timeout is defined (#616)
IB-8151 Signed-off-by: Raul Metsma <[email protected]>
1 parent a760b2c commit 721b83a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/crypto/Connect.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ Connect::Connect(const string &_url, string _method, int _timeout, const vector<
113113
this_thread::sleep_for(chrono::milliseconds(50));
114114
}
115115
#else
116-
if(BIO_do_connect_retry(d, timeout, -1) < 1)
116+
if(timeout > 0 && BIO_do_connect_retry(d, timeout, -1) < 1)
117117
THROW_NETWORKEXCEPTION("Failed to create connection with host timeout: '%s'", hostname.c_str())
118+
if(timeout == 0 && BIO_do_connect(d) < 1)
119+
THROW_NETWORKEXCEPTION("Failed to create connection with host: '%s'", hostname.c_str())
118120
#endif
119121

120122
if(usessl > 0)
@@ -313,6 +315,7 @@ Connect::Result Connect::exec(initializer_list<pair<string_view,string_view>> he
313315
pos = r.content.find("\r\n\r\n");
314316
if(pos != string::npos)
315317
r.content.erase(0, pos + 4);
318+
316319
if(const auto it = r.headers.find("transfer-encoding");
317320
it != r.headers.cend() &&
318321
it->second.find("chunked") != string::npos) {

0 commit comments

Comments
 (0)