The socket should be retrieved within the loop as it is possible

that the socket handle changes.
This commit is contained in:
eelke 2019-11-06 20:16:15 +01:00
parent 6bb5525d5e
commit 2c9cda990d

View file

@ -173,12 +173,12 @@ bool ASyncDBConnectionThread::makeConnection()
bool ok = m_connection.connectStart(conn_string); //keywords, values);
auto start = std::chrono::steady_clock::now();
if (ok && m_connection.status() != CONNECTION_BAD) {
int sock = m_connection.socket();
Win32Event socket_event(Win32Event::Reset::Auto, Win32Event::Initial::Clear);
long fd = FD_WRITE;
while (true) {
// poll till complete or failed (we can get an abort command)
int sock = m_connection.socket();
WSAEventSelect(sock, socket_event.handle(), fd);
WaitHandleList whl;
auto wait_result_socket_event = whl.add(socket_event);