aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-02-14 14:29:34 -0500
committerDeterminant <[email protected]>2020-02-14 14:29:34 -0500
commit7dc5ec52b1c419c58c68d7359870a292ab12d7db (patch)
tree214f2999decf1bf24f0cf777467eff73ceb08d62
parent46a35d57f2565b306285023b27d28187167205c8 (diff)
move the config option to MsgNetwork::Config
-rw-r--r--include/salticidae/conn.h15
-rw-r--r--include/salticidae/network.h19
-rw-r--r--test/test_p2p_stress.cpp3
3 files changed, 19 insertions, 18 deletions
diff --git a/include/salticidae/conn.h b/include/salticidae/conn.h
index 4e2f0f9..9afc813 100644
--- a/include/salticidae/conn.h
+++ b/include/salticidae/conn.h
@@ -359,12 +359,9 @@ class ConnPool {
class Config {
friend class ConnPool;
- template<typename OpcodeType> friend class MsgNetwork;
int _max_listen_backlog;
double _conn_server_timeout;
size_t _seg_buff_size;
- size_t _max_msg_size;
- size_t _max_msg_queue_size;
size_t _max_recv_buff_size;
size_t _nworker;
size_t _queue_capacity;
@@ -381,8 +378,6 @@ class ConnPool {
_max_listen_backlog(10),
_conn_server_timeout(2),
_seg_buff_size(4096),
- _max_msg_size(1024),
- _max_msg_queue_size(65536),
_max_recv_buff_size(4096),
_nworker(1),
_queue_capacity(0),
@@ -409,16 +404,6 @@ class ConnPool {
return *this;
}
- Config &max_msg_size(size_t x) {
- _max_msg_size = x;
- return *this;
- }
-
- Config &max_msg_queue_size(size_t x) {
- _max_msg_queue_size = x;
- return *this;
- }
-
Config &max_recv_buff_size(size_t x) {
_max_recv_buff_size = x;
return *this;
diff --git a/include/salticidae/network.h b/include/salticidae/network.h
index 18f3a42..3ecffe7 100644
--- a/include/salticidae/network.h
+++ b/include/salticidae/network.h
@@ -155,13 +155,28 @@ class MsgNetwork: public ConnPool {
public:
class Config: public ConnPool::Config {
- friend MsgNetwork;
+ friend class MsgNetwork;
+ size_t _max_msg_size;
+ size_t _max_msg_queue_size;
size_t _burst_size;
public:
Config(): Config(ConnPool::Config()) {}
Config(const ConnPool::Config &config):
- ConnPool::Config(config), _burst_size(1000) {}
+ ConnPool::Config(config),
+ _max_msg_size(1024),
+ _max_msg_queue_size(65536),
+ _burst_size(1000) {}
+
+ Config &max_msg_size(size_t x) {
+ _max_msg_size = x;
+ return *this;
+ }
+
+ Config &max_msg_queue_size(size_t x) {
+ _max_msg_queue_size = x;
+ return *this;
+ }
Config &burst_size(size_t x) {
_burst_size = x;
diff --git a/test/test_p2p_stress.cpp b/test/test_p2p_stress.cpp
index e4341bb..4e16e30 100644
--- a/test/test_p2p_stress.cpp
+++ b/test/test_p2p_stress.cpp
@@ -225,7 +225,8 @@ int main(int argc, char **argv) {
.nworker(opt_nworker->get())
.seg_buff_size(seg_buff_size))
.conn_timeout(opt_conn_timeout->get())
- .ping_period(opt_ping_peroid->get()));
+ .ping_period(opt_ping_peroid->get())
+ .max_msg_size(65536));
a.tcall = new ThreadCall(a.ec);
if (!opt_no_msg->get())
install_proto(a, seg_buff_size);