summaryrefslogtreecommitdiff
path: root/methods/basehttp.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-10-26 00:57:26 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-12-13 23:56:29 +0100
commit47c0bdc310c8cd62374ca6e6bb456dd183bdfc07 (patch)
treeb951a0221dd6015ffef42ebea9dfc709f6053404 /methods/basehttp.h
parent2f6aed72f656494d668918aa8ce4052d7c81e993 (diff)
report transient errors as transient errors
The Fail method for acquire methods has a boolean parameter indicating the transient-nature of a reported error. The problem with this is that Fail is called very late at a point where it is no longer easily identifiable if an error is indeed transient or not, so some calls were and some weren't and the acquire system would later mostly ignore the transient flag and guess by using the FailReason instead. Introducing a tri-state enum we can pass the information about fatal or transient errors through the callstack to generate the correct fails.
Diffstat (limited to 'methods/basehttp.h')
-rw-r--r--methods/basehttp.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/methods/basehttp.h b/methods/basehttp.h
index aadd59168..8220c1b3c 100644
--- a/methods/basehttp.h
+++ b/methods/basehttp.h
@@ -62,7 +62,6 @@ struct RequestState
RequestState(BaseHttpMethod * const Owner, ServerState * const Server) :
Owner(Owner), Server(Server) { time(&Date); }
};
-
struct ServerState
{
bool Persistent;
@@ -78,7 +77,7 @@ struct ServerState
BaseHttpMethod *Owner;
virtual bool ReadHeaderLines(std::string &Data) = 0;
- virtual bool LoadNextResponse(bool const ToFile, RequestState &Req) = 0;
+ virtual ResultState LoadNextResponse(bool const ToFile, RequestState &Req) = 0;
public:
@@ -99,16 +98,16 @@ struct ServerState
virtual bool WriteResponse(std::string const &Data) = 0;
/** \brief Transfer the data from the socket */
- virtual bool RunData(RequestState &Req) = 0;
- virtual bool RunDataToDevNull(RequestState &Req) = 0;
+ virtual ResultState RunData(RequestState &Req) = 0;
+ virtual ResultState RunDataToDevNull(RequestState &Req) = 0;
- virtual bool Open() = 0;
+ virtual ResultState Open() = 0;
virtual bool IsOpen() = 0;
virtual bool Close() = 0;
virtual bool InitHashes(HashStringList const &ExpectedHashes) = 0;
- virtual bool Die(RequestState &Req) = 0;
+ virtual ResultState Die(RequestState &Req) = 0;
virtual bool Flush(FileFd * const File) = 0;
- virtual bool Go(bool ToFile, RequestState &Req) = 0;
+ virtual ResultState Go(bool ToFile, RequestState &Req) = 0;
virtual Hashes * GetHashes() = 0;
ServerState(URI Srv, BaseHttpMethod *Owner);