fixed bug with dummy server destructor being nasty
This commit is contained in:
parent
6b152827af
commit
d93624bbf4
2 changed files with 10 additions and 2 deletions
|
|
@ -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<class t_connection_context = net_utils::connection_context_base>
|
||||
struct levin_commands_handler_dummy: public levin_commands_handler<t_connection_context>
|
||||
{
|
||||
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
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ class async_protocol_handler_config
|
|||
critical_section m_connects_lock;
|
||||
std::atomic<bool> m_is_in_sendstop_loop;
|
||||
connections_map m_connects;
|
||||
levin_commands_handler_dummy<t_connection_context> m_commands_handler_dummy;
|
||||
|
||||
void add_connection(async_protocol_handler<t_connection_context>* pc);
|
||||
void del_connection(async_protocol_handler<t_connection_context>* 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()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue