Commit 80cb0676 authored by maksymb@chromium.org's avatar maksymb@chromium.org

GCP2.0 Device: New timeouts (5 sec).

BUG=

Review URL: https://chromiumcodereview.appspot.com/22306002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215847 0039d316-1c4b-4281-b951-d872f2087c98
parent df26e138
...@@ -240,9 +240,9 @@ PrivetHttpServer::RegistrationErrorStatus Printer::RegistrationGetClaimToken( ...@@ -240,9 +240,9 @@ PrivetHttpServer::RegistrationErrorStatus Printer::RegistrationGetClaimToken(
if (reg_info_.confirmation_state != RegistrationInfo::CONFIRMATION_CONFIRMED) if (reg_info_.confirmation_state != RegistrationInfo::CONFIRMATION_CONFIRMED)
return ConfirmationToRegistrationError(reg_info_.confirmation_state); return ConfirmationToRegistrationError(reg_info_.confirmation_state);
// If reply wasn't received yet, reply with |device_busy| error. // If reply wasn't received yet, reply with |pending_user_action| error.
if (reg_info_.state == RegistrationInfo::DEV_REG_REGISTRATION_STARTED) if (reg_info_.state == RegistrationInfo::DEV_REG_REGISTRATION_STARTED)
return PrivetHttpServer::REG_ERROR_DEVICE_BUSY; return PrivetHttpServer::REG_ERROR_PENDING_USER_ACTION;
DCHECK_EQ(reg_info_.state, DCHECK_EQ(reg_info_.state,
RegistrationInfo::DEV_REG_REGISTRATION_CLAIM_TOKEN_READY); RegistrationInfo::DEV_REG_REGISTRATION_CLAIM_TOKEN_READY);
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
namespace { namespace {
const int kDeviceBusyTimeout = 30; // in seconds
const int kPendingUserActionTimeout = 5; // in seconds
// {"error":|error_type|} // {"error":|error_type|}
scoped_ptr<base::DictionaryValue> CreateError(const std::string& error_type) { scoped_ptr<base::DictionaryValue> CreateError(const std::string& error_type) {
scoped_ptr<base::DictionaryValue> error(new base::DictionaryValue); scoped_ptr<base::DictionaryValue> error(new base::DictionaryValue);
...@@ -296,10 +299,12 @@ void PrivetHttpServer::ProcessRegistrationStatus( ...@@ -296,10 +299,12 @@ void PrivetHttpServer::ProcessRegistrationStatus(
*current_response = CreateError("invalid_params"); *current_response = CreateError("invalid_params");
break; break;
case REG_ERROR_DEVICE_BUSY: case REG_ERROR_DEVICE_BUSY:
*current_response = CreateErrorWithTimeout("device_busy", 30); *current_response = CreateErrorWithTimeout("device_busy",
kDeviceBusyTimeout);
break; break;
case REG_ERROR_PENDING_USER_ACTION: case REG_ERROR_PENDING_USER_ACTION:
*current_response = CreateErrorWithTimeout("pending_user_action", 30); *current_response = CreateErrorWithTimeout("pending_user_action",
kPendingUserActionTimeout);
break; break;
case REG_ERROR_USER_CANCEL: case REG_ERROR_USER_CANCEL:
*current_response = CreateError("user_cancel"); *current_response = CreateError("user_cancel");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment