File tree Expand file tree Collapse file tree 1 file changed +21
-9
lines changed
Expand file tree Collapse file tree 1 file changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,12 @@ void TIGER_API::PushSocket::disconnect()
9393{
9494 if (keep_alive_timer_)
9595 {
96- keep_alive_timer_->cancel ();
96+ boost::system::error_code ec;
97+ keep_alive_timer_->cancel (ec);
98+ if (ec)
99+ {
100+ LOG (ERROR) << ec;
101+ }
97102 }
98103 close_session ();
99104}
@@ -171,10 +176,7 @@ unsigned int TIGER_API::PushSocket::get_next_id()
171176
172177void TIGER_API::PushSocket::close_session ()
173178{
174- if (reconnect_timer_)
175- {
176- reconnect_timer_->cancel ();
177- }
179+ cancel_reconnect_timer ();
178180
179181 LOG (INFO) << " close socket" ;
180182 socket_state_ = SocketState::DISCONNECTED;
@@ -280,6 +282,19 @@ void TIGER_API::PushSocket::auto_reconnect()
280282 });
281283}
282284
285+ void TIGER_API::PushSocket::cancel_reconnect_timer ()
286+ {
287+ if (reconnect_timer_)
288+ {
289+ boost::system::error_code ec;
290+ reconnect_timer_->cancel (ec);
291+ if (ec)
292+ {
293+ LOG (ERROR) << ec;
294+ }
295+ }
296+ }
297+
283298void TIGER_API::PushSocket::handle_connect (const boost::system::error_code& error, boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
284299{
285300 try
@@ -479,10 +494,7 @@ void TIGER_API::PushSocket::handle_timer(const boost::system::error_code& error)
479494 }
480495 else if (socket_state_ == SocketState::DISCONNECTED)
481496 {
482- if (reconnect_timer_)
483- {
484- reconnect_timer_->cancel ();
485- }
497+ cancel_reconnect_timer ();
486498 auto_reconnect ();
487499 }
488500
You can’t perform that action at this time.
0 commit comments