Electroneum
Loading...
Searching...
No Matches
srv.cpp File Reference
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
#include "include_base_utils.h"
#include "misc_log_ex.h"
#include "storages/levin_abstract_invoke2.h"
#include "common/util.h"
#include "net_load_tests.h"
Include dependency graph for srv.cpp:

Go to the source code of this file.

Macros

#define EXIT_ON_ERROR(cond)

Functions

int main (int argc, char **argv)

Macro Definition Documentation

◆ EXIT_ON_ERROR

#define EXIT_ON_ERROR ( cond)
Value:
{ if (!(cond)) { LOG_PRINT_L0("ERROR: " << #cond); exit(1); } else {} }
#define LOG_PRINT_L0(x)
Definition misc_log_ex.h:99

Definition at line 44 of file srv.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 218 of file srv.cpp.

219{
220 TRY_ENTRY();
222 //set up logging options
223 mlog_configure(mlog_get_default_log_path("net_load_tests_srv.log"), true);
224
225 size_t thread_count = (std::max)(min_thread_count, boost::thread::hardware_concurrency() / 2);
226
228 if (!tcp_server.init_server(srv_port, "127.0.0.1"))
229 return 1;
230
231 srv_levin_commands_handler *commands_handler = new srv_levin_commands_handler(tcp_server);
232 tcp_server.get_config_object().set_handler(commands_handler, [](epee::levin::levin_commands_handler<test_connection_context> *handler) { delete handler; });
233 tcp_server.get_config_object().m_invoke_timeout = 10000;
234 //tcp_server.get_config_object().m_max_packet_size = max_packet_size;
235
236 if (!tcp_server.run_server(thread_count, true))
237 return 2;
238 return 0;
239 CATCH_ENTRY_L0("main", 1);
240}
void mlog_configure(const std::string &filename_base, bool console, const std::size_t max_log_file_size=MAX_LOG_FILE_SIZE, const std::size_t max_log_files=MAX_LOG_FILES)
Definition mlog.cpp:148
std::string mlog_get_default_log_path(const char *default_filename)
Definition mlog.cpp:72
#define CATCH_ENTRY_L0(lacation, return_val)
#define TRY_ENTRY()
const std::string srv_port("36231")
const unsigned int min_thread_count
epee::net_utils::boosted_tcp_server< test_levin_protocol_handler > test_tcp_server
bool on_startup()
Definition util.cpp:778
Here is the call graph for this function: