Address test network issues
[ Merge of http://go/wvgerrit/22140 ] There are occasional issues when trying to connect to http://widevine-proxy.appspot.com/proxy . This changes introduces upto 3 retry attempts. The UAT server on appspot is being replaced by UAT on borg and so it is not worth our while to debug these issues furthur. b/30022298 Change-Id: I76c1421e93c7c14b5d2bcd7ad07119a705245922
This commit is contained in:
@@ -13,6 +13,7 @@ namespace wvcdm {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
const int kMaxConnectAttempts = 3;
|
||||||
const int kReadBufferSize = 1024;
|
const int kReadBufferSize = 1024;
|
||||||
const int kConnectTimeoutMs = 15000;
|
const int kConnectTimeoutMs = 15000;
|
||||||
const int kWriteTimeoutMs = 12000;
|
const int kWriteTimeoutMs = 12000;
|
||||||
@@ -79,12 +80,14 @@ UrlRequest::UrlRequest(const std::string& url)
|
|||||||
UrlRequest::~UrlRequest() {}
|
UrlRequest::~UrlRequest() {}
|
||||||
|
|
||||||
void UrlRequest::Reconnect() {
|
void UrlRequest::Reconnect() {
|
||||||
socket_.CloseSocket();
|
for(uint32_t i = 0; i < kMaxConnectAttempts && !is_connected_; ++i) {
|
||||||
if (socket_.Connect(kConnectTimeoutMs)) {
|
socket_.CloseSocket();
|
||||||
is_connected_ = true;
|
if (socket_.Connect(kConnectTimeoutMs)) {
|
||||||
} else {
|
is_connected_ = true;
|
||||||
LOGE("failed to connect to %s, port=%d", socket_.domain_name().c_str(),
|
} else {
|
||||||
socket_.port());
|
LOGE("failed to connect to %s, port=%d", socket_.domain_name().c_str(),
|
||||||
|
socket_.port());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user