Compare commits

..
2 Commits
Author SHA1 Message Date
Morteza Bashsiz 67c43de80d implement pullTimeout
Add configurable
```
  # pullTimeout: unsigned short
  # Defines the timeout for I/O Operation in milliseconds.
  #   Useful to expire serverside read timer.
  pullTimeout: 50
```
Higher number helps when your network is slower
2026-06-01 15:53:38 +02:00
Morteza Bashsiz ab4580920f implement pullTimeout (#178) 2026-06-01 15:47:15 +02:00
5 changed files with 12 additions and 4 deletions

No files matched your search

+2
View File
@@ -13,6 +13,7 @@ Config::Config(const RunMode &mode, const std::string &filePath)
configYaml_["general"]["methods"].as<std::vector<std::string>>(),
configYaml_["general"]["endPoints"].as<std::vector<std::string>>(),
configYaml_["general"]["timeout"].as<unsigned short>(),
configYaml_["general"]["pullTimeout"].as<unsigned short>(),
configYaml_["general"]["tunnelEnable"].as<bool>(false),
configYaml_["general"]["connectionReuse"].as<bool>(false),
configYaml_["general"]["tlsEnable"].as<bool>(false),
@@ -106,6 +107,7 @@ std::string Config::toString() const {
ss << "\n"
<< " timeout: " << general_.timeout << "\n"
<< " pullTimeout: " << general_.pullTimeout << "\n"
<< " tunnelEnable: " << std::boolalpha << general_.tunnelEnable << "\n"
<< " connectionReuse: " << std::boolalpha << general_.connectionReuse << "\n"
<< " tlsEnable: " << std::boolalpha << general_.tlsEnable << "\n"
+1
View File
@@ -24,6 +24,7 @@ private:
std::vector<std::string> methods;
std::vector<std::string> endPoints;
unsigned short timeout;
unsigned short pullTimeout;
bool tunnelEnable;
bool connectionReuse;
bool tlsEnable;
+1
View File
@@ -329,6 +329,7 @@ inline BoolStr validateConfig(int argc, const char *argv[]) {
configYaml["general"]["methods"].as<std::vector<std::string>>();
configYaml["general"]["endPoints"].as<std::vector<std::string>>();
configYaml["general"]["timeout"].as<unsigned short>();
configYaml["general"]["pullTimeout"].as<unsigned short>();
configYaml["general"]["tunnelEnable"].as<bool>();
} catch (const std::exception &e) {
result.message = std::string("Error in 'general' block: ") + e.what() + "\n";
+1 -1
View File
@@ -512,7 +512,7 @@ void TCPConnection::startTunnelPollServer() {
pollInProgress_ = true;
pollTimer_.expires_after(std::chrono::milliseconds(10));
pollTimer_.expires_after(std::chrono::milliseconds(config_->general().pullTimeout));
pollTimer_.async_wait(
boost::asio::bind_executor(
strand_,
+7 -3
View File
@@ -6,16 +6,16 @@ general:
# fakeUrls:
# Defines the list of fake urls between agent and server
fakeUrls:
- www.google.com
- nipo.ciron.net
- sudoer.net
- sudoer.ir
- sudoer.net
- google.com
- cloudflare.com
# methods:
# Defines the list of using methods
# you like to send requests from agent to server
# Program will choose randomly from this list
methods:
- HEAD
- GET
- POST
- PUT
@@ -33,6 +33,10 @@ general:
# Defines the timeout for I/O Operation in seconds. 0 indicates no timeout.
# Useful to automatically close stalled connections.
timeout: 10
# pullTimeout: unsigned short
# Defines the timeout for I/O Operation in milliseconds.
# Useful to expire serverside read timer.
pullTimeout: 50
# tunnelEnable: bool
# Defines the connection mode between agent and server. If enabled then the traffic
# will be TCP/TLS tunnel like.