Skip to content
Snippets Groups Projects
Commit 0a1cb4f0 authored by Leslie Linden's avatar Leslie Linden
Browse files

EXP-1791 FIX -- Handle case where initialization with SLM fails in the...

EXP-1791 FIX -- Handle case where initialization with SLM fails in the Merchant Outbox floater in the viewer

* Updated marketplace import to properly handle failed cases of authentications
  and invalid cookies.  The import will reset to an uninitialized state and then
  trigger and initialization followed immediately by an import when appropriate.
parent 00b767e5
No related branches found
No related tags found
No related merge requests found
...@@ -438,7 +438,6 @@ void LLFloaterOutbox::importReportResults(U32 status, const LLSD& content) ...@@ -438,7 +438,6 @@ void LLFloaterOutbox::importReportResults(U32 status, const LLSD& content)
LLSD subs; LLSD subs;
subs["[ERROR_CODE]"] = status_string; subs["[ERROR_CODE]"] = status_string;
//llassert(status == MarketplaceErrorCodes::IMPORT_JOB_FAILED);
LLNotificationsUtil::add("OutboxImportFailed", subs); LLNotificationsUtil::add("OutboxImportFailed", subs);
} }
......
...@@ -133,6 +133,17 @@ namespace LLMarketplaceImport ...@@ -133,6 +133,17 @@ namespace LLMarketplaceImport
llinfos << " SLM POST content: " << content.asString() << llendl; llinfos << " SLM POST content: " << content.asString() << llendl;
} }
if ((status == MarketplaceErrorCodes::IMPORT_REDIRECT) ||
(status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR))
{
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM POST clearing marketplace cookie due to authentication failure" << llendl;
}
sMarketplaceCookie.clear();
}
sImportInProgress = (status == MarketplaceErrorCodes::IMPORT_DONE); sImportInProgress = (status == MarketplaceErrorCodes::IMPORT_DONE);
sImportPostPending = false; sImportPostPending = false;
sImportResultStatus = status; sImportResultStatus = status;
...@@ -330,16 +341,6 @@ LLMarketplaceInventoryImporter::LLMarketplaceInventoryImporter() ...@@ -330,16 +341,6 @@ LLMarketplaceInventoryImporter::LLMarketplaceInventoryImporter()
{ {
} }
void LLMarketplaceInventoryImporter::initialize()
{
llassert(!mInitialized);
if (!LLMarketplaceImport::hasSessionCookie())
{
LLMarketplaceImport::establishMarketplaceSessionCookie();
}
}
boost::signals2::connection LLMarketplaceInventoryImporter::setInitializationErrorCallback(const status_report_signal_t::slot_type& cb) boost::signals2::connection LLMarketplaceInventoryImporter::setInitializationErrorCallback(const status_report_signal_t::slot_type& cb)
{ {
if (mErrorInitSignal == NULL) if (mErrorInitSignal == NULL)
...@@ -370,17 +371,32 @@ boost::signals2::connection LLMarketplaceInventoryImporter::setStatusReportCallb ...@@ -370,17 +371,32 @@ boost::signals2::connection LLMarketplaceInventoryImporter::setStatusReportCallb
return mStatusReportSignal->connect(cb); return mStatusReportSignal->connect(cb);
} }
void LLMarketplaceInventoryImporter::initialize()
{
llassert(!mInitialized);
if (!LLMarketplaceImport::hasSessionCookie())
{
LLMarketplaceImport::establishMarketplaceSessionCookie();
}
}
void LLMarketplaceInventoryImporter::reinitializeAndTriggerImport()
{
mInitialized = false;
initialize();
mAutoTriggerImport = true;
}
bool LLMarketplaceInventoryImporter::triggerImport() bool LLMarketplaceInventoryImporter::triggerImport()
{ {
const bool import_triggered = LLMarketplaceImport::triggerImport(); const bool import_triggered = LLMarketplaceImport::triggerImport();
if (!import_triggered) if (!import_triggered)
{ {
mInitialized = false; reinitializeAndTriggerImport();
initialize();
mAutoTriggerImport = true;
} }
return import_triggered; return import_triggered;
...@@ -396,23 +412,14 @@ void LLMarketplaceInventoryImporter::updateImport() ...@@ -396,23 +412,14 @@ void LLMarketplaceInventoryImporter::updateImport()
if (!polling_status) if (!polling_status)
{ {
mInitialized = false; reinitializeAndTriggerImport();
initialize();
mAutoTriggerImport = true;
} }
} }
if (mImportInProgress != in_progress) if (mImportInProgress != in_progress)
{ {
mImportInProgress = in_progress; mImportInProgress = in_progress;
if (mStatusChangedSignal)
{
(*mStatusChangedSignal)(mImportInProgress);
}
// If we are no longer in progress // If we are no longer in progress
if (!mImportInProgress) if (!mImportInProgress)
{ {
...@@ -436,7 +443,7 @@ void LLMarketplaceInventoryImporter::updateImport() ...@@ -436,7 +443,7 @@ void LLMarketplaceInventoryImporter::updateImport()
{ {
mAutoTriggerImport = false; mAutoTriggerImport = false;
triggerImport(); mImportInProgress = triggerImport();
} }
} }
else if (mErrorInitSignal) else if (mErrorInitSignal)
...@@ -445,6 +452,12 @@ void LLMarketplaceInventoryImporter::updateImport() ...@@ -445,6 +452,12 @@ void LLMarketplaceInventoryImporter::updateImport()
} }
} }
} }
// Make sure we trigger the status change with the final state (in case of auto trigger after initialize)
if (mStatusChangedSignal)
{
(*mStatusChangedSignal)(mImportInProgress);
}
} }
} }
...@@ -46,6 +46,7 @@ namespace MarketplaceErrorCodes ...@@ -46,6 +46,7 @@ namespace MarketplaceErrorCodes
{ {
IMPORT_DONE = 200, IMPORT_DONE = 200,
IMPORT_PROCESSING = 202, IMPORT_PROCESSING = 202,
IMPORT_REDIRECT = 302,
IMPORT_AUTHENTICATION_ERROR = 401, IMPORT_AUTHENTICATION_ERROR = 401,
IMPORT_DONE_WITH_ERRORS = 409, IMPORT_DONE_WITH_ERRORS = 409,
IMPORT_JOB_FAILED = 410, IMPORT_JOB_FAILED = 410,
...@@ -61,8 +62,6 @@ class LLMarketplaceInventoryImporter ...@@ -61,8 +62,6 @@ class LLMarketplaceInventoryImporter
LLMarketplaceInventoryImporter(); LLMarketplaceInventoryImporter();
void initialize();
typedef boost::signals2::signal<void (bool)> status_changed_signal_t; typedef boost::signals2::signal<void (bool)> status_changed_signal_t;
typedef boost::signals2::signal<void (U32, const LLSD&)> status_report_signal_t; typedef boost::signals2::signal<void (U32, const LLSD&)> status_report_signal_t;
...@@ -70,10 +69,12 @@ class LLMarketplaceInventoryImporter ...@@ -70,10 +69,12 @@ class LLMarketplaceInventoryImporter
boost::signals2::connection setStatusChangedCallback(const status_changed_signal_t::slot_type& cb); boost::signals2::connection setStatusChangedCallback(const status_changed_signal_t::slot_type& cb);
boost::signals2::connection setStatusReportCallback(const status_report_signal_t::slot_type& cb); boost::signals2::connection setStatusReportCallback(const status_report_signal_t::slot_type& cb);
void initialize();
bool triggerImport(); bool triggerImport();
bool isImportInProgress() const { return mImportInProgress; } bool isImportInProgress() const { return mImportInProgress; }
protected: protected:
void reinitializeAndTriggerImport();
void updateImport(); void updateImport();
private: private:
......
...@@ -230,8 +230,9 @@ All folders were successfully sent to the Marketplace. ...@@ -230,8 +230,9 @@ All folders were successfully sent to the Marketplace.
type="outbox"> type="outbox">
Some folders did not transfer Some folders did not transfer
Errors occurred when some folders were sent to the Marketplace. Those folders are still in your Merchant Outbox. See the error log for more information. Errors occurred when some folders were sent to the Marketplace. Those folders are still in your Merchant Outbox.
See the error log for more information.
<usetemplate <usetemplate
name="okbutton" name="okbutton"
yestext="OK"/> yestext="OK"/>
...@@ -245,8 +246,6 @@ Transfer failed ...@@ -245,8 +246,6 @@ Transfer failed
No folders were sent to the Marketplace because of a system or network error. Try again later. No folders were sent to the Marketplace because of a system or network error. Try again later.
Error [ERROR_CODE]
<usetemplate <usetemplate
name="okbutton" name="okbutton"
yestext="OK"/> yestext="OK"/>
...@@ -260,8 +259,6 @@ Marketplace initialization failed ...@@ -260,8 +259,6 @@ Marketplace initialization failed
Initialization with the Marketplace failed because of a system or network error. Try again later. Initialization with the Marketplace failed because of a system or network error. Try again later.
Error [ERROR_CODE]
<usetemplate <usetemplate
name="okbutton" name="okbutton"
yestext="OK"/> yestext="OK"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment