Method checks if pool is empty ; if not, it take the first connection from pool.
However, IIUC, pool is locked in underlying methods is_pool_empty() and get_head(), so this does not work reliably (get_head() may fail, unless a higher lock ensures this can not happen)
if (is_pool_empty())
{
// No connections in pool => create a new connection instance.
return std::make_shared<linux_connection>(m_io_service);
}
else
{
// Reuse connection from pool.
auto connection(get_head());
connection->start_reuse();
return connection;
}
Comments: This has been fixed in the development branch and will be in the 2.4.0 release. Thanks for reporting the issue.
However, IIUC, pool is locked in underlying methods is_pool_empty() and get_head(), so this does not work reliably (get_head() may fail, unless a higher lock ensures this can not happen)
if (is_pool_empty())
{
// No connections in pool => create a new connection instance.
return std::make_shared<linux_connection>(m_io_service);
}
else
{
// Reuse connection from pool.
auto connection(get_head());
connection->start_reuse();
return connection;
}
Comments: This has been fixed in the development branch and will be in the 2.4.0 release. Thanks for reporting the issue.