Make symupload v2 api respect --timeout flag

Change-Id: I763f45aa395a56e9c3285544e7755a1e5a85dbe4
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3422007
Reviewed-by: Nelson Billing <nbilling@google.com>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Zequan Wu 2022-01-27 16:52:13 -08:00 committed by Nelson Billing
parent f6974b15ef
commit d55a5f3dca
3 changed files with 16 additions and 10 deletions

View file

@ -12,6 +12,7 @@ namespace google_breakpad {
bool SymbolCollectorClient::CreateUploadUrl(
wstring& api_url,
wstring& api_key,
int* timeout_ms,
UploadUrlResponse *uploadUrlResponse) {
wstring url = api_url +
L"/v1/uploads:create"
@ -23,7 +24,7 @@ namespace google_breakpad {
url,
L"",
L"",
NULL,
timeout_ms,
&response,
&response_code)) {
wprintf(L"Failed to create upload url.\n");
@ -66,6 +67,7 @@ namespace google_breakpad {
CompleteUploadResult SymbolCollectorClient::CompleteUpload(
wstring& api_url,
wstring& api_key,
int* timeout_ms,
const wstring& upload_key,
const wstring& debug_file,
const wstring& debug_id) {
@ -84,7 +86,7 @@ namespace google_breakpad {
url,
body,
L"application/json",
NULL,
timeout_ms,
&response,
&response_code)) {
wprintf(L"Failed to complete upload.\n");
@ -116,6 +118,7 @@ namespace google_breakpad {
SymbolStatus SymbolCollectorClient::CheckSymbolStatus(
wstring& api_url,
wstring& api_key,
int* timeout_ms,
const wstring& debug_file,
const wstring& debug_id) {
wstring response;
@ -126,7 +129,7 @@ namespace google_breakpad {
if (!HTTPUpload::SendGetRequest(
url,
NULL,
timeout_ms,
&response,
&response_code)) {
wprintf(L"Failed to check symbol status.\n");

View file

@ -64,6 +64,7 @@ namespace google_breakpad {
static bool CreateUploadUrl(
wstring& api_url,
wstring& api_key,
int* timeout_ms,
UploadUrlResponse *uploadUrlResponse);
// Notify the API that symbol file upload is finished and its contents
@ -71,6 +72,7 @@ namespace google_breakpad {
static CompleteUploadResult CompleteUpload(
wstring& api_url,
wstring& api_key,
int* timeout_ms,
const wstring& upload_key,
const wstring& debug_file,
const wstring& debug_id);
@ -80,6 +82,7 @@ namespace google_breakpad {
static SymbolStatus CheckSymbolStatus(
wstring& api_url,
wstring& api_key,
int* timeout_ms,
const wstring& debug_file,
const wstring& debug_id);
};

View file

@ -163,6 +163,7 @@ static bool DumpSymbolsToTempFile(const wchar_t* file,
static bool DoSymUploadV2(
const wchar_t* api_url,
const wchar_t* api_key,
int* timeout_ms,
const wstring& debug_file,
const wstring& debug_id,
const wstring& symbol_file,
@ -174,6 +175,7 @@ static bool DoSymUploadV2(
SymbolStatus symbolStatus = SymbolCollectorClient::CheckSymbolStatus(
url,
key,
timeout_ms,
debug_file,
debug_id);
if (symbolStatus == SymbolStatus::Found) {
@ -191,6 +193,7 @@ static bool DoSymUploadV2(
if (!SymbolCollectorClient::CreateUploadUrl(
url,
key,
timeout_ms,
&uploadUrlResponse)) {
wprintf(L"Failed to create upload URL.\n");
return false;
@ -203,7 +206,7 @@ static bool DoSymUploadV2(
bool success = HTTPUpload::SendPutRequest(
signed_url,
symbol_file,
/* timeout = */ NULL,
timeout_ms,
&response,
&response_code);
if (!success) {
@ -228,6 +231,7 @@ static bool DoSymUploadV2(
SymbolCollectorClient::CompleteUpload(
url,
key,
timeout_ms,
upload_key,
debug_file,
debug_id);
@ -339,12 +343,8 @@ int wmain(int argc, wchar_t* argv[]) {
api_key = argv[currentarg++];
success = DoSymUploadV2(
api_url,
api_key,
pdb_info.debug_file,
pdb_info.debug_identifier,
symbol_file,
force);
api_url, api_key, timeout == -1 ? nullptr : &timeout,
pdb_info.debug_file, pdb_info.debug_identifier, symbol_file, force);
} else {
printUsageAndExit();
}