The socket should be retrieved within the loop as it is possible
that the socket handle changes.
This commit is contained in:
parent
6bb5525d5e
commit
2c9cda990d
1 changed files with 1 additions and 1 deletions
|
|
@ -173,12 +173,12 @@ bool ASyncDBConnectionThread::makeConnection()
|
||||||
bool ok = m_connection.connectStart(conn_string); //keywords, values);
|
bool ok = m_connection.connectStart(conn_string); //keywords, values);
|
||||||
auto start = std::chrono::steady_clock::now();
|
auto start = std::chrono::steady_clock::now();
|
||||||
if (ok && m_connection.status() != CONNECTION_BAD) {
|
if (ok && m_connection.status() != CONNECTION_BAD) {
|
||||||
int sock = m_connection.socket();
|
|
||||||
Win32Event socket_event(Win32Event::Reset::Auto, Win32Event::Initial::Clear);
|
Win32Event socket_event(Win32Event::Reset::Auto, Win32Event::Initial::Clear);
|
||||||
|
|
||||||
long fd = FD_WRITE;
|
long fd = FD_WRITE;
|
||||||
while (true) {
|
while (true) {
|
||||||
// poll till complete or failed (we can get an abort command)
|
// poll till complete or failed (we can get an abort command)
|
||||||
|
int sock = m_connection.socket();
|
||||||
WSAEventSelect(sock, socket_event.handle(), fd);
|
WSAEventSelect(sock, socket_event.handle(), fd);
|
||||||
WaitHandleList whl;
|
WaitHandleList whl;
|
||||||
auto wait_result_socket_event = whl.add(socket_event);
|
auto wait_result_socket_event = whl.add(socket_event);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue