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:
parent
f6974b15ef
commit
d55a5f3dca
3 changed files with 16 additions and 10 deletions
|
@ -12,6 +12,7 @@ namespace google_breakpad {
|
||||||
bool SymbolCollectorClient::CreateUploadUrl(
|
bool SymbolCollectorClient::CreateUploadUrl(
|
||||||
wstring& api_url,
|
wstring& api_url,
|
||||||
wstring& api_key,
|
wstring& api_key,
|
||||||
|
int* timeout_ms,
|
||||||
UploadUrlResponse *uploadUrlResponse) {
|
UploadUrlResponse *uploadUrlResponse) {
|
||||||
wstring url = api_url +
|
wstring url = api_url +
|
||||||
L"/v1/uploads:create"
|
L"/v1/uploads:create"
|
||||||
|
@ -23,7 +24,7 @@ namespace google_breakpad {
|
||||||
url,
|
url,
|
||||||
L"",
|
L"",
|
||||||
L"",
|
L"",
|
||||||
NULL,
|
timeout_ms,
|
||||||
&response,
|
&response,
|
||||||
&response_code)) {
|
&response_code)) {
|
||||||
wprintf(L"Failed to create upload url.\n");
|
wprintf(L"Failed to create upload url.\n");
|
||||||
|
@ -66,6 +67,7 @@ namespace google_breakpad {
|
||||||
CompleteUploadResult SymbolCollectorClient::CompleteUpload(
|
CompleteUploadResult SymbolCollectorClient::CompleteUpload(
|
||||||
wstring& api_url,
|
wstring& api_url,
|
||||||
wstring& api_key,
|
wstring& api_key,
|
||||||
|
int* timeout_ms,
|
||||||
const wstring& upload_key,
|
const wstring& upload_key,
|
||||||
const wstring& debug_file,
|
const wstring& debug_file,
|
||||||
const wstring& debug_id) {
|
const wstring& debug_id) {
|
||||||
|
@ -84,7 +86,7 @@ namespace google_breakpad {
|
||||||
url,
|
url,
|
||||||
body,
|
body,
|
||||||
L"application/json",
|
L"application/json",
|
||||||
NULL,
|
timeout_ms,
|
||||||
&response,
|
&response,
|
||||||
&response_code)) {
|
&response_code)) {
|
||||||
wprintf(L"Failed to complete upload.\n");
|
wprintf(L"Failed to complete upload.\n");
|
||||||
|
@ -116,6 +118,7 @@ namespace google_breakpad {
|
||||||
SymbolStatus SymbolCollectorClient::CheckSymbolStatus(
|
SymbolStatus SymbolCollectorClient::CheckSymbolStatus(
|
||||||
wstring& api_url,
|
wstring& api_url,
|
||||||
wstring& api_key,
|
wstring& api_key,
|
||||||
|
int* timeout_ms,
|
||||||
const wstring& debug_file,
|
const wstring& debug_file,
|
||||||
const wstring& debug_id) {
|
const wstring& debug_id) {
|
||||||
wstring response;
|
wstring response;
|
||||||
|
@ -126,7 +129,7 @@ namespace google_breakpad {
|
||||||
|
|
||||||
if (!HTTPUpload::SendGetRequest(
|
if (!HTTPUpload::SendGetRequest(
|
||||||
url,
|
url,
|
||||||
NULL,
|
timeout_ms,
|
||||||
&response,
|
&response,
|
||||||
&response_code)) {
|
&response_code)) {
|
||||||
wprintf(L"Failed to check symbol status.\n");
|
wprintf(L"Failed to check symbol status.\n");
|
||||||
|
|
|
@ -64,6 +64,7 @@ namespace google_breakpad {
|
||||||
static bool CreateUploadUrl(
|
static bool CreateUploadUrl(
|
||||||
wstring& api_url,
|
wstring& api_url,
|
||||||
wstring& api_key,
|
wstring& api_key,
|
||||||
|
int* timeout_ms,
|
||||||
UploadUrlResponse *uploadUrlResponse);
|
UploadUrlResponse *uploadUrlResponse);
|
||||||
|
|
||||||
// Notify the API that symbol file upload is finished and its contents
|
// Notify the API that symbol file upload is finished and its contents
|
||||||
|
@ -71,6 +72,7 @@ namespace google_breakpad {
|
||||||
static CompleteUploadResult CompleteUpload(
|
static CompleteUploadResult CompleteUpload(
|
||||||
wstring& api_url,
|
wstring& api_url,
|
||||||
wstring& api_key,
|
wstring& api_key,
|
||||||
|
int* timeout_ms,
|
||||||
const wstring& upload_key,
|
const wstring& upload_key,
|
||||||
const wstring& debug_file,
|
const wstring& debug_file,
|
||||||
const wstring& debug_id);
|
const wstring& debug_id);
|
||||||
|
@ -80,6 +82,7 @@ namespace google_breakpad {
|
||||||
static SymbolStatus CheckSymbolStatus(
|
static SymbolStatus CheckSymbolStatus(
|
||||||
wstring& api_url,
|
wstring& api_url,
|
||||||
wstring& api_key,
|
wstring& api_key,
|
||||||
|
int* timeout_ms,
|
||||||
const wstring& debug_file,
|
const wstring& debug_file,
|
||||||
const wstring& debug_id);
|
const wstring& debug_id);
|
||||||
};
|
};
|
||||||
|
|
|
@ -163,6 +163,7 @@ static bool DumpSymbolsToTempFile(const wchar_t* file,
|
||||||
static bool DoSymUploadV2(
|
static bool DoSymUploadV2(
|
||||||
const wchar_t* api_url,
|
const wchar_t* api_url,
|
||||||
const wchar_t* api_key,
|
const wchar_t* api_key,
|
||||||
|
int* timeout_ms,
|
||||||
const wstring& debug_file,
|
const wstring& debug_file,
|
||||||
const wstring& debug_id,
|
const wstring& debug_id,
|
||||||
const wstring& symbol_file,
|
const wstring& symbol_file,
|
||||||
|
@ -174,6 +175,7 @@ static bool DoSymUploadV2(
|
||||||
SymbolStatus symbolStatus = SymbolCollectorClient::CheckSymbolStatus(
|
SymbolStatus symbolStatus = SymbolCollectorClient::CheckSymbolStatus(
|
||||||
url,
|
url,
|
||||||
key,
|
key,
|
||||||
|
timeout_ms,
|
||||||
debug_file,
|
debug_file,
|
||||||
debug_id);
|
debug_id);
|
||||||
if (symbolStatus == SymbolStatus::Found) {
|
if (symbolStatus == SymbolStatus::Found) {
|
||||||
|
@ -191,6 +193,7 @@ static bool DoSymUploadV2(
|
||||||
if (!SymbolCollectorClient::CreateUploadUrl(
|
if (!SymbolCollectorClient::CreateUploadUrl(
|
||||||
url,
|
url,
|
||||||
key,
|
key,
|
||||||
|
timeout_ms,
|
||||||
&uploadUrlResponse)) {
|
&uploadUrlResponse)) {
|
||||||
wprintf(L"Failed to create upload URL.\n");
|
wprintf(L"Failed to create upload URL.\n");
|
||||||
return false;
|
return false;
|
||||||
|
@ -203,7 +206,7 @@ static bool DoSymUploadV2(
|
||||||
bool success = HTTPUpload::SendPutRequest(
|
bool success = HTTPUpload::SendPutRequest(
|
||||||
signed_url,
|
signed_url,
|
||||||
symbol_file,
|
symbol_file,
|
||||||
/* timeout = */ NULL,
|
timeout_ms,
|
||||||
&response,
|
&response,
|
||||||
&response_code);
|
&response_code);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
@ -228,6 +231,7 @@ static bool DoSymUploadV2(
|
||||||
SymbolCollectorClient::CompleteUpload(
|
SymbolCollectorClient::CompleteUpload(
|
||||||
url,
|
url,
|
||||||
key,
|
key,
|
||||||
|
timeout_ms,
|
||||||
upload_key,
|
upload_key,
|
||||||
debug_file,
|
debug_file,
|
||||||
debug_id);
|
debug_id);
|
||||||
|
@ -339,12 +343,8 @@ int wmain(int argc, wchar_t* argv[]) {
|
||||||
api_key = argv[currentarg++];
|
api_key = argv[currentarg++];
|
||||||
|
|
||||||
success = DoSymUploadV2(
|
success = DoSymUploadV2(
|
||||||
api_url,
|
api_url, api_key, timeout == -1 ? nullptr : &timeout,
|
||||||
api_key,
|
pdb_info.debug_file, pdb_info.debug_identifier, symbol_file, force);
|
||||||
pdb_info.debug_file,
|
|
||||||
pdb_info.debug_identifier,
|
|
||||||
symbol_file,
|
|
||||||
force);
|
|
||||||
} else {
|
} else {
|
||||||
printUsageAndExit();
|
printUsageAndExit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue