Added read message max size in socket communication (#42)

* Added peermaxmsg size to config

* Completed inital implementation

* Completed adding message max size

* Refactored code

* Refactored code to have data types using std library

* Added peer maxmpm

* Added const to session_options
This commit is contained in:
Ravidu Lashan
2019-10-25 11:34:54 +05:30
committed by GitHub
parent 40358890af
commit 46d114f44b
8 changed files with 107 additions and 57 deletions

View File

@@ -53,6 +53,11 @@ net::io_context ioc;
*/
std::thread listener_thread;
/**
* Used to pass down the default settings to the socket session
*/
sock::session_options sess_opts;
// Challenge response fields.
// These fields are used on challenge response validation.
static const char *CHALLENGE_RESP_TYPE = "type";
@@ -251,13 +256,17 @@ int remove_user(const std::string &sessionid)
*/
void start_listening()
{
auto address = net::ip::make_address(conf::cfg.listenip);
sess_opts.max_message_size = conf::cfg.pubmaxsize;
std::make_shared<sock::socket_server<user_outbound_message>>(
ioc,
ctx,
tcp::endpoint{address, conf::cfg.pubport},
global_usr_session_handler)
global_usr_session_handler,
sess_opts)
->run();
listener_thread = std::thread([&] { ioc.run(); });