3 #include "../http/httpclienttask.h"
4 #include "../http/httphost.h"
13 unsigned int no_conn = 1,
unsigned int max_conn = 3,
14 double timeout = 25.0) :
16 no_connections(no_conn),
17 active_connections(0),
18 max_connections(max_conn),
20 ticket_string(ticket) {
21 setUserAgentString(measurement::appName +
" " + measurement::appVersion);
29 std::string cacheLabel()
override {
37 checkConnectionCount();
52 virtual void connectionLost() {
53 log() <<
"connectionLost()";
58 static std::string json_obj(
const std::string &attr,
59 const std::string &value);
64 static std::string fValue(
double x) {
66 s.imbue(std::locale(
"C"));
71 static std::string calculateLatency(std::vector<double> &samples);
76 void checkConnectionCount();
79 void setNoConnections(
unsigned int no) {
81 checkConnectionCount();
84 unsigned int getNoConnections()
const {
85 return no_connections;
88 unsigned int currentNoConnections()
const {
89 return active_connections;
92 void noMoreConnections() {
101 log() <<
"Task timeout.";
112 unsigned int no_connections, active_connections, max_connections;
114 std::string ticket_string;
API for HTTP clients.
Definition: httpclienttask.h:11
The host name and port number of a HTTP host.
Definition: httphost.h:17
std::ostream & log() const
Write a line of info log.
Definition: logger.h:328
Definition: measurementtask.h:9
double start() override
Definition: measurementtask.h:36
This class implements low-level socket connection operations. Inherit from it to implement protocols ...
Definition: socketconnection.h:47
void setResult(const std::string &res)
Definition: task.cpp:18
double elapsed() const
Return number of seconds since the task was started.
Definition: task.h:234