Unify network strategies with upcoming proxy.
This commit is contained in:
parent
a2f747fb0c
commit
c46c019c83
10 changed files with 110 additions and 45 deletions
|
@ -40,13 +40,15 @@ class Url;
|
|||
class FailoverStrategy : public IStrategy, public IClientListener
|
||||
{
|
||||
public:
|
||||
FailoverStrategy(const std::vector<Url*> &urls, int retryPause, int retries, const char *agent, IStrategyListener *listener);
|
||||
FailoverStrategy(const std::vector<Url*> &urls, int retryPause, int retries, IStrategyListener *listener);
|
||||
~FailoverStrategy();
|
||||
|
||||
public:
|
||||
inline bool isActive() const override { return m_active >= 0; }
|
||||
|
||||
int64_t submit(const JobResult &result) override;
|
||||
void connect() override;
|
||||
void release() override;
|
||||
void resume() override;
|
||||
void stop() override;
|
||||
void tick(uint64_t now) override;
|
||||
|
@ -58,12 +60,14 @@ protected:
|
|||
void onResultAccepted(Client *client, const SubmitResult &result, const char *error) override;
|
||||
|
||||
private:
|
||||
void add(const Url *url, const char *agent);
|
||||
void add(const Url *url);
|
||||
|
||||
bool m_release;
|
||||
const int m_retries;
|
||||
const int m_retryPause;
|
||||
int m_active;
|
||||
int m_index;
|
||||
int m_remaining;
|
||||
IStrategyListener *m_listener;
|
||||
std::vector<Client*> m_pools;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue