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 {
|
||||
|
||||
const int kMaxConnectAttempts = 3;
|
||||
const int kReadBufferSize = 1024;
|
||||
const int kConnectTimeoutMs = 15000;
|
||||
const int kWriteTimeoutMs = 12000;
|
||||
@@ -79,12 +80,14 @@ UrlRequest::UrlRequest(const std::string& url)
|
||||
UrlRequest::~UrlRequest() {}
|
||||
|
||||
void UrlRequest::Reconnect() {
|
||||
socket_.CloseSocket();
|
||||
if (socket_.Connect(kConnectTimeoutMs)) {
|
||||
is_connected_ = true;
|
||||
} else {
|
||||
LOGE("failed to connect to %s, port=%d", socket_.domain_name().c_str(),
|
||||
socket_.port());
|
||||
for(uint32_t i = 0; i < kMaxConnectAttempts && !is_connected_; ++i) {
|
||||
socket_.CloseSocket();
|
||||
if (socket_.Connect(kConnectTimeoutMs)) {
|
||||
is_connected_ = true;
|
||||
} else {
|
||||
LOGE("failed to connect to %s, port=%d", socket_.domain_name().c_str(),
|
||||
socket_.port());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user