Skip to content

Commit

Permalink
Disable open timeout when duration is set to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
zaphoyd committed Jul 25, 2014
1 parent 3560fa1 commit ad2932b
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions websocketpp/transport/asio/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,16 +477,19 @@ class connection : public config::socket_type::socket_con_type {
}

timer_ptr post_timer;
post_timer = set_timer(
config::timeout_socket_post_init,
lib::bind(
&type::handle_post_init_timeout,
get_shared(),
post_timer,
m_init_handler,
lib::placeholders::_1
)
);

if (config::timeout_socket_post_init > 0) {
post_timer = set_timer(
config::timeout_socket_post_init,
lib::bind(
&type::handle_post_init_timeout,
get_shared(),
post_timer,
m_init_handler,
lib::placeholders::_1
)
);
}

socket_con_type::post_init(
lib::bind(
Expand Down Expand Up @@ -530,13 +533,15 @@ class connection : public config::socket_type::socket_con_type {
lib::error_code const & ec)
{
if (ec == transport::error::operation_aborted ||
post_timer->expires_from_now().is_negative())
(post_timer && post_timer->expires_from_now().is_negative()))
{
m_alog.write(log::alevel::devel,"post_init cancelled");
return;
}

post_timer->cancel();
if (post_timer) {
post_timer->cancel();
}

if (m_alog.static_test(log::alevel::devel)) {
m_alog.write(log::alevel::devel,"asio connection handle_post_init");
Expand Down

0 comments on commit ad2932b

Please sign in to comment.