Bredbandskollen CLI  1.2
Asynchronous network task engine
downloadtask.h
1 // Copyright (c) 2018 IIS (The Internet Foundation in Sweden)
2 // Written by Göran Andersson <initgoran@gmail.com>
3 
4 #pragma once
5 
6 #include "progresstask.h"
7 
8 class DownloadTask : public ProgressTask {
9 public:
10  DownloadTask(const std::string &ticket, const HttpHost &server,
11  unsigned int no_conn = 10, unsigned int max_conn = 100,
12  double duration = 10.0, double max_time = 25.0,
13  double tick_s = 0.1);
14  double start() override;
15  double timerEvent() override;
16  void newRequest(HttpClientConnection *) override;
17  bool headerComplete(HttpClientConnection *) override;
18  void payload(HttpClientConnection *, char *, size_t len) override;
19 private:
20  double tick_duration_s;
21  double dynamic_conn_limit;
22 };
Definition: downloadtask.h:8
void payload(HttpClientConnection *, char *, size_t len) override
Data has arrived from the server.
Definition: downloadtask.cpp:66
double start() override
Definition: downloadtask.cpp:14
void newRequest(HttpClientConnection *) override
Initiate next request, or ignore to close connection.
Definition: downloadtask.cpp:48
double timerEvent() override
Definition: downloadtask.cpp:21
bool headerComplete(HttpClientConnection *) override
Called when response headers are fully read and parsed, except for websocket upgrades,...
Definition: downloadtask.cpp:60
HTTP/1.1 client protocol.
Definition: httpclientconnection.h:39
The host name and port number of a HTTP host.
Definition: httphost.h:17
Definition: progresstask.h:5