diff --git a/contrib/epee/include/net/levin_base.h b/contrib/epee/include/net/levin_base.h index 4f55b0df..1d7ccb44 100644 --- a/contrib/epee/include/net/levin_base.h +++ b/contrib/epee/include/net/levin_base.h @@ -86,9 +86,16 @@ namespace levin virtual void on_connection_new(t_connection_context& context){}; virtual void on_connection_close(t_connection_context& context){}; - }; + template + struct levin_commands_handler_dummy: public levin_commands_handler + { + virtual int invoke(int command, const std::string& in_buff, std::string& buff_out, t_connection_context& context) { return LEVIN_OK; } + virtual int notify(int command, const std::string& in_buff, t_connection_context& context) { return LEVIN_OK; } + }; + + #define LEVIN_OK 0 #define LEVIN_ERROR_CONNECTION -1 #define LEVIN_ERROR_CONNECTION_NOT_FOUND -2 diff --git a/contrib/epee/include/net/levin_protocol_handler_async.h b/contrib/epee/include/net/levin_protocol_handler_async.h index d85fa428..d2c536ba 100644 --- a/contrib/epee/include/net/levin_protocol_handler_async.h +++ b/contrib/epee/include/net/levin_protocol_handler_async.h @@ -59,6 +59,7 @@ class async_protocol_handler_config critical_section m_connects_lock; std::atomic m_is_in_sendstop_loop; connections_map m_connects; + levin_commands_handler_dummy m_commands_handler_dummy; void add_connection(async_protocol_handler* pc); void del_connection(async_protocol_handler* pc); @@ -87,7 +88,7 @@ public: bool foreach_connection(callback_t cb); size_t get_connections_count(); - async_protocol_handler_config() :m_pcommands_handler(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_is_in_sendstop_loop(false), m_invoke_timeout{} + async_protocol_handler_config() :m_pcommands_handler(&m_commands_handler_dummy), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_is_in_sendstop_loop(false), m_invoke_timeout{} {} ~async_protocol_handler_config() {