Picked up changes from viewer-maint-2287

Adaptation of current merchant outbox project viewer to conform to Singularity's needs.

Adds the following commits by Merov Linden:
a5db366 MAINT-2287 : WIP : Implement a market place state
43fc74b MAINT-2287 : WIP : Fix compile issue
cb887fe MAINT-2287 : Fixed : Test the merchant/no merchant status without relying on outbox, Recreate missing outbox for a merchant, UI clean up on init.
f1934c0 MAINT-2301 : WIP : Catch a bit more 4xx and 5xx error codes, display the error code in the alert.
3fbbe6c MAINT-2301 : Fixed : Ignoring 499 timeout errors on POST (safe).
3dc6263 MAINT-2301 : Do not treat 404 errors (server returns not found) as 403 errors (forbidden, i.e. resident is not a merchant)
94039ee MAINT-2301 : Change messaging in the Merchant Outbox panel when an error happened, so not to be confused with the not-a-merchant case.
7c9cb2e MAINT-2452 : Fixed : Do not clear the cookie in IMPORT_DONE_WITH_ERRORS case so future retry have a chance to work.
67b872e WENG-618   : Added debug printout for POST and GET when InventoryOutboxLogging is turned on

Translators, you will need to update strings.xml and notifications.xml for this change.
This commit is contained in:
Lirusaito
2013-04-18 23:28:09 -04:00
parent 2b3350d686
commit 8f3ff01703
6 changed files with 175 additions and 58 deletions

View File

@@ -166,20 +166,25 @@ namespace LLMarketplaceImport
llinfos << " SLM POST status: " << status << llendl;
llinfos << " SLM POST reason: " << reason << llendl;
llinfos << " SLM POST content: " << content.asString() << llendl;
llinfos << " SLM POST timer: " << slmPostTimer.getElapsedTimeF32() << llendl;
}
if ((status == MarketplaceErrorCodes::IMPORT_REDIRECT) ||
(status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR) ||
(status == MarketplaceErrorCodes::IMPORT_JOB_LOW_SPEED) ||
(status == MarketplaceErrorCodes::IMPORT_JOB_TIMEOUT))
// MAINT-2301 : we determined we can safely ignore that error in that context
if (status == MarketplaceErrorCodes::IMPORT_JOB_TIMEOUT)
{
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM POST clearing marketplace cookie due to authentication failure or timeout" << llendl;
llinfos << " SLM POST : Ignoring time out status and treating it as success" << llendl;
}
status = MarketplaceErrorCodes::IMPORT_DONE;
}
if (status >= MarketplaceErrorCodes::IMPORT_BAD_REQUEST)
{
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM POST clearing marketplace cookie due to client or server error" << llendl;
}
sMarketplaceCookie.clear();
}
@@ -224,21 +229,23 @@ namespace LLMarketplaceImport
llinfos << " SLM GET status: " << status << llendl;
llinfos << " SLM GET reason: " << reason << llendl;
llinfos << " SLM GET content: " << content.asString() << llendl;
llinfos << " SLM GET timer: " << slmGetTimer.getElapsedTimeF32() << llendl;
}
if ((status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR) ||
(status == MarketplaceErrorCodes::IMPORT_JOB_LOW_SPEED) ||
(status == MarketplaceErrorCodes::IMPORT_JOB_TIMEOUT))
// MAINT-2452 : Do not clear the cookie on IMPORT_DONE_WITH_ERRORS
if ((status >= MarketplaceErrorCodes::IMPORT_BAD_REQUEST) &&
(status != MarketplaceErrorCodes::IMPORT_DONE_WITH_ERRORS))
{
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM GET clearing marketplace cookie due to authentication failure or timeout (" << status << " / " << reason << ")." << llendl;
llinfos << " SLM GET clearing marketplace cookie due to client or server error (" << status << " / " << reason << ")." << llendl;
}
sMarketplaceCookie.clear();
}
else if (gSavedSettings.getBOOL("InventoryOutboxLogging") && (status == MarketplaceErrorCodes::IMPORT_DONE_WITH_ERRORS))
{
llinfos << " SLM GET : Got IMPORT_DONE_WITH_ERRORS, marketplace cookie not cleared." << llendl;
}
sImportInProgress = (status == MarketplaceErrorCodes::IMPORT_PROCESSING);
sImportGetPending = false;
@@ -334,7 +341,9 @@ namespace LLMarketplaceImport
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM GET: " << url << llendl;
llinfos << " SLM GET: pollStatus, LLHTTPClient::get, url = " << url << llendl;
llinfos << " SLM GET: headers " << llendl;
llinfos << headers << llendl;
}
slmGetTimer.start();
@@ -368,7 +377,9 @@ namespace LLMarketplaceImport
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM POST: " << url << llendl;
llinfos << " SLM POST: triggerImport, LLHTTPClient::post, url = " << url << llendl;
llinfos << " SLM POST: headers " << llendl;
llinfos << headers << llendl;
}
slmPostTimer.start();
@@ -404,6 +415,7 @@ LLMarketplaceInventoryImporter::LLMarketplaceInventoryImporter()
: mAutoTriggerImport(false)
, mImportInProgress(false)
, mInitialized(false)
, mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
, mErrorInitSignal(NULL)
, mStatusChangedSignal(NULL)
, mStatusReportSignal(NULL)
@@ -446,16 +458,20 @@ void LLMarketplaceInventoryImporter::initialize()
if (!LLMarketplaceImport::hasSessionCookie())
{
mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING;
LLMarketplaceImport::establishMarketplaceSessionCookie();
}
else
{
mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_MERCHANT;
}
}
void LLMarketplaceInventoryImporter::reinitializeAndTriggerImport()
{
mInitialized = false;
mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED;
initialize();
mAutoTriggerImport = true;
}
@@ -507,17 +523,30 @@ void LLMarketplaceInventoryImporter::updateImport()
if (mInitialized)
{
mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_MERCHANT;
// Follow up with auto trigger of import
if (mAutoTriggerImport)
{
mAutoTriggerImport = false;
mImportInProgress = triggerImport();
}
}
else if (mErrorInitSignal)
else
{
(*mErrorInitSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults());
U32 status = LLMarketplaceImport::getResultStatus();
if ((status == MarketplaceErrorCodes::IMPORT_FORBIDDEN) ||
(status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR))
{
mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT;
}
else
{
mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE;
}
if (mErrorInitSignal && (mMarketPlaceStatus == MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE))
{
(*mErrorInitSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults());
}
}
}
}