@@ -104,15 +104,8 @@ namespace web { namespace http
104
104
}
105
105
106
106
bool is_reused () const { return m_is_reused; }
107
-
108
107
void set_keep_alive (bool keep_alive) { m_keep_alive = keep_alive; }
109
108
bool keep_alive () const { return m_keep_alive; }
110
-
111
- bool is_open ()
112
- {
113
- std::lock_guard<std::mutex> lock (m_socket_lock);
114
- return m_socket.is_open ();
115
- }
116
109
bool is_ssl () const { return m_ssl_stream ? true : false ; }
117
110
118
111
template <typename Iterator, typename Handler>
@@ -552,9 +545,9 @@ namespace web { namespace http
552
545
// Start connection timeout timer.
553
546
ctx->m_timer .start ();
554
547
555
- if (ctx->m_connection ->is_open ())
548
+ if (ctx->m_connection ->is_reused ())
556
549
{
557
- // If socket is already open ( connection is reused) , try to write the request directly.
550
+ // If socket is a reused connection, try to write the request directly.
558
551
write_request (ctx);
559
552
}
560
553
else
@@ -869,7 +862,7 @@ namespace web { namespace http
869
862
const bool socket_was_closed ((boost::asio::error::eof == ec)
870
863
|| (boost::asio::error::connection_reset == ec)
871
864
|| (boost::asio::error::connection_aborted == ec));
872
- if (socket_was_closed && ctx->m_connection ->is_reused () && ctx-> m_connection -> is_open () )
865
+ if (socket_was_closed && ctx->m_connection ->is_reused ())
873
866
{
874
867
// Failed to write to socket because connection was already closed while it was in the pool.
875
868
// close() here ensures socket is closed in a robust way and prevents the connection from being put to the pool again.
0 commit comments