File: throttler.hpp

package info (click to toggle)
libfilezilla 0.52.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,492 kB
  • sloc: cpp: 30,965; sh: 4,241; makefile: 375; xml: 37
file content (22 lines) | stat: -rw-r--r-- 455 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef LIBFILEZILLA_HTTP_THROTTLER_HEADER
#define LIBFILEZILLA_HTTP_THROTTLER_HEADER

#include "../libfilezilla/mutex.hpp"
#include "../libfilezilla/time.hpp"

namespace fz::http::client {

class request_throttler final
{
public:
	void throttle(std::string const& hostname, datetime const& backoff);
	duration get_throttle(std::string const& hostname);

private:
	mutex mtx_{false};
	std::vector<std::pair<std::string, datetime>> backoff_;
};

}

#endif