Improved way sockets are closed.
Not 100% sure this is allowed by boost::asio thought a code inspection suggest it does as it is ignoring the error it gets on close.
This commit is contained in:
parent
61645d44ac
commit
5e83094e6a
1 changed files with 4 additions and 1 deletions
|
|
@ -40,6 +40,7 @@ void ASyncDBConnection::setupConnection(const ConnectionConfig &config)
|
|||
// auto start = std::chrono::steady_clock::now();
|
||||
if (ok && m_connection.status() != CONNECTION_BAD) {
|
||||
auto sock_handle = m_connection.socket();
|
||||
|
||||
m_asioSock.assign(ip::tcp::v4(), sock_handle);
|
||||
m_asioSock.non_blocking(true);
|
||||
|
||||
|
|
@ -99,7 +100,9 @@ void ASyncDBConnection::closeConnection()
|
|||
m_canceller.cancel(nullptr);
|
||||
}
|
||||
if (m_state != State::NotConnected) {
|
||||
m_asioSock.close();
|
||||
// Do not really want to close it before libpq is finished with it
|
||||
// However explicitly is the destroctor doing the right thing?
|
||||
//m_asioSock.close();
|
||||
m_connection.close();
|
||||
}
|
||||
doStateCallback(State::NotConnected);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue