summaryrefslogtreecommitdiff
path: root/include/tgbot/net
diff options
context:
space:
mode:
authorllnulldisk <48621230+llnulldisk@users.noreply.github.com>2023-01-29 14:54:20 +0100
committerllnulldisk <48621230+llnulldisk@users.noreply.github.com>2023-01-29 14:54:20 +0100
commita8defacf2ba9bc3029b16af48a539553f873866b (patch)
tree8cea4cad5a8bc15e8213193743111f41a73e1461 /include/tgbot/net
parent443b769670046340e266893e00f947c9ce37462f (diff)
Fix timeout issues (#251)
Diffstat (limited to 'include/tgbot/net')
-rw-r--r--include/tgbot/net/HttpClient.h2
-rw-r--r--include/tgbot/net/TgLongPoll.h8
2 files changed, 7 insertions, 3 deletions
diff --git a/include/tgbot/net/HttpClient.h b/include/tgbot/net/HttpClient.h
index a35dd7d..024c8ad 100644
--- a/include/tgbot/net/HttpClient.h
+++ b/include/tgbot/net/HttpClient.h
@@ -26,6 +26,8 @@ public:
* If at least 1 arg is marked as file, the content type of a request will be multipart/form-data, otherwise it will be application/x-www-form-urlencoded.
*/
virtual std::string makeRequest(const Url& url, const std::vector<HttpReqArg>& args) const = 0;
+
+ std::int32_t _timeout = 25;
};
}
diff --git a/include/tgbot/net/TgLongPoll.h b/include/tgbot/net/TgLongPoll.h
index 417260a..9c50407 100644
--- a/include/tgbot/net/TgLongPoll.h
+++ b/include/tgbot/net/TgLongPoll.h
@@ -1,6 +1,7 @@
#ifndef TGBOT_TGLONGPOLL_H
#define TGBOT_TGLONGPOLL_H
+#include "tgbot/Api.h"
#include "tgbot/export.h"
#include <cstdint>
@@ -10,7 +11,6 @@
namespace TgBot {
-class Api;
class Bot;
class EventHandler;
@@ -22,8 +22,8 @@ class EventHandler;
class TGBOT_API TgLongPoll {
public:
- TgLongPoll(const Api* api, const EventHandler* eventHandler, std::int32_t, std::int32_t, std::shared_ptr<std::vector<std::string>>);
- TgLongPoll(const Bot& bot, std::int32_t = 100, std::int32_t = 10, const std::shared_ptr<std::vector<std::string>>& = nullptr);
+ TgLongPoll(const Api* api, const EventHandler* eventHandler, std::int32_t limit, std::int32_t timeout, std::shared_ptr<std::vector<std::string>> allowUpdates);
+ TgLongPoll(const Bot& bot, std::int32_t limit = 100, std::int32_t timeout = 10, const std::shared_ptr<std::vector<std::string>>& allowUpdates = nullptr);
/**
* @brief Starts long poll. After new update will come, this method will parse it and send to EventHandler which invokes your listeners. Designed to be executed in a loop.
@@ -37,6 +37,8 @@ private:
std::int32_t _limit;
std::int32_t _timeout;
std::shared_ptr<std::vector<std::string>> _allowUpdates;
+
+ std::vector<Update::Ptr> _updates;
};
}