more robust client when dealing with slow network connections

This commit is contained in:
Redmond Urbino 2010-08-06 21:36:18 +00:00
parent 834ff90f7c
commit 6b837e55fd
3 changed files with 20 additions and 1 deletions

View File

@ -194,6 +194,16 @@ underflow() {
// the server. But BIO_should_retry() *appears* to be
// reliable.
_read_open = (BIO_should_retry(*_source) != 0);
#ifdef IS_OSX
// occassionally we get -1 on read_open on the mac
// the os_error is 35 which means "Resource temporarily unavailable".
if ( (_read_open == -1) && (os_error == 35)) {
downloader_cat.warning() << "forcing retry to true again and _read_open to true\n";
BIO_set_retry_read(*_source);
_read_open = true;
}
#endif
if (!_read_open) {
downloader_cat.info()
<< "Lost connection to "

View File

@ -44,6 +44,11 @@ HTTPChannel::
HTTPChannel(HTTPClient *client) :
_client(client)
{
ConfigVariableDouble extra_ssl_handshake_time
("extra-ssl-handshake-time", 0.0,
PRC_DESC("This specifies how much extra time to try to establish"
"the ssl handshake before we bail."));
_extra_ssl_handshake_time = extra_ssl_handshake_time;
_proxy_next_index = 0;
_persistent_connection = false;
_allow_proxy = true;
@ -1563,7 +1568,7 @@ run_ssl_handshake() {
double elapsed =
TrueClock::get_global_ptr()->get_short_time() -
_started_connecting_time;
if (elapsed <= get_connect_timeout()) {
if (elapsed <= get_connect_timeout() + _extra_ssl_handshake_time) {
// Keep trying.
return true;
}

View File

@ -429,6 +429,10 @@ private:
int _last_status_code;
double _last_run_time;
// RAU we find that we may need a little more time for the
// ssl handshake when the phase files are downloading
double _extra_ssl_handshake_time;
public:
virtual TypeHandle get_type() const {
return get_class_type();