Add improved timeout handling for HTTP transactions.
Introduces AIHTTPTimeoutPolicy objects which do not just specify a single "timeout" in seconds, but a plethora of timings related to the life cycle of the average HTTP transaction. This knowledge is that moved to the Responder being used instead of floating constants hardcoded in the callers of http requests. This assumes that the same timeout policy is wanted for each transaction that uses the same Responder, which can be enforced is needed. I added a AIHTTPTimeoutPolicy for EVERY responder, only to make it easier later to tune timeout values and/or to get feedback about which responder runs into HTTP errors in debug output (especially time outs), so that they can be tuned later. If we already understood exactly what we were doing then most responders could have been left alone and just return the default timeout policy: by far most timeout policies are just a copy of the default policy, currently. This commit is not finished... It's a work in progress (viewer runs fine with it though).
This commit is contained in:
@@ -37,6 +37,10 @@
|
||||
#include "llviewerregion.h"
|
||||
#include "lluictrlfactory.h"
|
||||
|
||||
class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy asyncConsoleResponder_timeout;
|
||||
extern AIHTTPTimeoutPolicy consoleResponder_timeout;
|
||||
|
||||
// Two versions of the sim console API are supported.
|
||||
//
|
||||
// SimConsole capability (deprecated):
|
||||
@@ -72,6 +76,7 @@ namespace
|
||||
// This responder handles the initial response. Unless error() is called
|
||||
// we assume that the simulator has received our request. Error will be
|
||||
// called if this request times out.
|
||||
//
|
||||
class AsyncConsoleResponder : public LLHTTPClient::Responder
|
||||
{
|
||||
public:
|
||||
@@ -80,6 +85,7 @@ namespace
|
||||
{
|
||||
sConsoleReplySignal(UNABLE_TO_SEND_COMMAND);
|
||||
}
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return asyncConsoleResponder_timeout; }
|
||||
};
|
||||
|
||||
class ConsoleResponder : public LLHTTPClient::Responder
|
||||
@@ -110,11 +116,14 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return consoleResponder_timeout; }
|
||||
|
||||
LLTextEditor * mOutput;
|
||||
};
|
||||
|
||||
// This handles responses for console commands sent via the asynchronous
|
||||
// API.
|
||||
|
||||
class ConsoleResponseNode : public LLHTTPNode
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user