Skip to content

Commit

Permalink
Merge pull request #126 from MortezaBashsiz/morteza/issue_119
Browse files Browse the repository at this point in the history
Remove chunksize
  • Loading branch information
MortezaBashsiz authored Nov 20, 2024
2 parents 2550d5e + bae49da commit 805bd0f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 16 deletions.
4 changes: 1 addition & 3 deletions core/src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ Config::Config(const RunMode &mode, const std::string &filePath)
configYaml_["general"]["timeWait"].as<unsigned int>(),
configYaml_["general"]["timeout"].as<unsigned short>(),
configYaml_["general"]["repeatWait"].as<unsigned short>(),
configYaml_["general"]["chunkHeader"].as<std::string>(),
configYaml_["general"]["chunkSize"].as<unsigned short>()}),
configYaml_["general"]["chunkHeader"].as<std::string>()}),
log_({configYaml_["log"]["logLevel"].as<std::string>(),
configYaml_["log"]["logFile"].as<std::string>()}),
server_({configYaml_["server"]["threads"].as<unsigned short>(),
Expand Down Expand Up @@ -66,7 +65,6 @@ std::string Config::toString() const {
<< " timeout: " << general_.timeout << "\n"
<< " repeatWait: " << general_.repeatWait << "\n"
<< " chunkHeader: " << general_.chunkHeader << "\n"
<< " chunkSize: " << general_.chunkSize << "\n"
<< " Log :\n"
<< " logLevel: " << log_.level << "\n"
<< " logFile: " << log_.file << "\n"
Expand Down
1 change: 0 additions & 1 deletion core/src/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class Config : private Uncopyable {
unsigned short timeout;
unsigned short repeatWait;
std::string chunkHeader;
unsigned short chunkSize;
};

struct Log {
Expand Down
1 change: 0 additions & 1 deletion core/src/general.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ inline BoolStr validateConfig(int argc, const char *argv[]) {
configYaml["general"]["timeout"].as<unsigned short>();
configYaml["general"]["repeatWait"].as<unsigned short>();
configYaml["general"]["chunkHeader"].as<std::string>();
configYaml["general"]["chunkSize"].as<unsigned short>();
} catch (const std::exception &e) {
result.message = std::string("Error in 'general' block: ") + e.what() + "\n";
return result;
Expand Down
4 changes: 0 additions & 4 deletions core/src/tcpclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ void TCPClient::doReadServer() {
Log::Level::DEBUG);
return;
}
if (buffer_.size() >= config_->general().chunkSize) {
end_ = true;
return;
}

resetTimeout();
boost::asio::read(socket_, tempBuff, boost::asio::transfer_exactly(2),
Expand Down
11 changes: 4 additions & 7 deletions nipovpn/etc/nipovpn/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,18 @@ general:
# timeWait: unsigned int(0-4,294,967,295)
# Defines the time wait between each repeat to read from socket.
# This directive will be useful when you expect to read very long stream from socket
timeWait: 0
timeWait: 1
# timeout: unsigned short
# Defines the timeout for I/O Operation in seconds. 0 indicates no timeout.
# Useful to automatically close stalled connections.
timeout: 10
timeout: 3
# repeatWait: unsigned short(1-65,635)
# Defines the loop count which will try to repeat read from socket.
# Same as timeWait
repeatWait: 1
repeatWait: 25
# chunkHeader: String
# Defines the chunk header that you want to inform Agent/Server if it is end or not.
chunkHeader: "END"
# chunkSize: unsigned short(512-65,535)
# Defines the chunk size that you want to read from socket.
chunkSize: 8152

# This block is to define log directives
log:
Expand Down Expand Up @@ -55,7 +52,7 @@ agent:
# listenPort: the port number which will be used on agent
listenPort: 8080
# serverIp: IPv4 of the nipoServer
serverIp: "127.0.0.1"
serverIp: "127.0.0.10"
# serverPort: port number of the nipoServer
serverPort: 443
# httpVersion: This version will be used between agent and server
Expand Down

0 comments on commit 805bd0f

Please sign in to comment.