Skip to content

Commit 459c457

Browse files
committed
Removing unnecessary is_open() function from linux_connection class.
1 parent a28b26f commit 459c457

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

Release/src/http/client/http_linux.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,8 @@ namespace web { namespace http
104104
}
105105

106106
bool is_reused() const { return m_is_reused; }
107-
108107
void set_keep_alive(bool keep_alive) { m_keep_alive = keep_alive; }
109108
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-
}
116109
bool is_ssl() const { return m_ssl_stream ? true : false; }
117110

118111
template <typename Iterator, typename Handler>
@@ -552,9 +545,9 @@ namespace web { namespace http
552545
// Start connection timeout timer.
553546
ctx->m_timer.start();
554547

555-
if (ctx->m_connection->is_open())
548+
if (ctx->m_connection->is_reused())
556549
{
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.
558551
write_request(ctx);
559552
}
560553
else
@@ -869,7 +862,7 @@ namespace web { namespace http
869862
const bool socket_was_closed((boost::asio::error::eof == ec)
870863
|| (boost::asio::error::connection_reset == ec)
871864
|| (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())
873866
{
874867
// Failed to write to socket because connection was already closed while it was in the pool.
875868
// close() here ensures socket is closed in a robust way and prevents the connection from being put to the pool again.

0 commit comments

Comments
 (0)