Add missed files

This commit is contained in:
Oleg.Korshul
2024-07-22 11:04:18 +03:00
parent 849d3fb09a
commit 62b96623a0
5 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,7 @@
<<<<<<<
m_packet_mgr.set_encode_callback(std::bind(&client_impl::on_encode,this,_1,_2));
=======
m_packet_mgr.set_encode_callback(std::bind(&client_impl::on_encode,this,_1,_2));
m_client.set_close_handshake_timeout(1);
>>>>>>>

View File

@ -0,0 +1,22 @@
<<<<<<<
if (m_con_state == con_closing) {
LOG("Connection failed while closing." << endl);
this->close();
return;
}
m_con.reset();
m_con_state = con_closed;
this->sockets_invoke_void(&sio_no_tls::socket::on_disconnect);
=======
con_state con_state_old = m_con_state;
m_con.reset();
m_con_state = con_closed;
this->sockets_invoke_void(&sio::socket::on_disconnect);
if (con_state_old == con_closing) {
LOG("Connection failed while closing." << endl);
this->close();
return;
}
>>>>>>>

View File

@ -0,0 +1,24 @@
<<<<<<<
if (m_con_state == con_closing) {
LOG("Connection opened while closing." << endl);
this->close();
return;
}
LOG("Connected." << endl);
m_con_state = con_opened;
m_con = con;
m_reconn_made = 0;
=======
con_state con_state_old = m_con_state;
LOG("Connected." << endl);
m_con_state = con_opened;
m_con = con;
m_reconn_made = 0;
if (con_state_old == con_closing) {
LOG("Connection opened while closing." << endl);
this->close();
return;
}
>>>>>>>

View File

@ -0,0 +1,40 @@
<<<<<<<
template <typename config>
void connection<config>::handle_terminate(terminate_status tstat,
lib::error_code const & ec)
{
if (m_alog->static_test(log::alevel::devel)) {
m_alog->write(log::alevel::devel,"connection handle_terminate");
}
if (ec) {
// there was an error actually shutting down the connection
log_err(log::elevel::devel,"handle_terminate",ec);
}
=======
template <typename config>
void connection<config>::handle_terminate(terminate_status tstat,
lib::error_code const & ec)
{
if (m_alog->static_test(log::alevel::devel)) {
m_alog->write(log::alevel::devel,"connection handle_terminate");
}
if (ec) {
// there was an error actually shutting down the connection
log_err(log::elevel::devel,"handle_terminate",ec);
}
// Even with all workarounds and bug fixes in socket-io master branch, still running into
// cases like https://github.com/socketio/socket.io-client-cpp/issues/254.
//
// After much investigation and debugging, seems like the socket is remaining
// open and preventing the network thread from ending. Perhaps this is specific to the
// environment where this code is run by Solink. The only solution seems to be manually
// closing the socket as described here: https://github.com/zaphoyd/websocketpp/issues/805
bool isSocketOpen = transport_con_type::get_raw_socket().is_open();
if (isSocketOpen) {
transport_con_type::get_raw_socket().close();
}
>>>>>>>

View File

@ -88,6 +88,17 @@ namespace NSNetwork
m_base->listener->onError("");
}
void event_onReconnecting()
{
CTemporaryCS oCS(&m_oCS_Events);
m_connecting_in_process = true;
}
void event_onReconnect(unsigned, unsigned)
{
CTemporaryCS oCS(&m_oCS_Events);
m_connecting_in_process = false;
}
public:
virtual void open(const std::map<std::string, std::string>& query) override
{
@ -96,6 +107,10 @@ namespace NSNetwork
m_socket->set_close_listener(std::bind(&CIOWebSocket_private_tls::event_onClose, this, std::placeholders::_1));
m_socket->set_fail_listener (std::bind(&CIOWebSocket_private_tls::event_onFail, this));
m_socket->set_reconnect_listener(std::bind(&CIOWebSocket_private_tls::event_onReconnect, this,
std::placeholders::_1, std::placeholders::_2));
m_socket->set_reconnecting_listener(std::bind(&CIOWebSocket_private_tls::event_onReconnecting, this));
sio::message::ptr objAuth = sio::object_message::create();
//std::string sAuth;