Fix bug in mingw driver, work on lpxclient

This commit is contained in:
2021-11-03 11:11:31 -04:00
parent 9a02f408b0
commit 17a1155906
2 changed files with 53 additions and 10 deletions

View File

@@ -169,6 +169,7 @@ public:
} else {
socket_[chid] = sock;
connected_[chid] = false;
Sleep(1000);
}
}
}
@@ -236,6 +237,7 @@ public:
bool any = false;
for (const auto &p : listen_sockets_) {
FD_SET(p.second, &rfds);
FD_SET(p.second, &efds);
any = true;
}
for (int chid = 1; chid < MAX_CHAN; chid++) {
@@ -243,7 +245,8 @@ public:
if (sock == INVALID_SOCKET) continue;
any = true;
FD_SET(sock, &rfds);
if ((!connected_[chid]) || (!driven_->drv_outgoing_empty(chid))) {
FD_SET(sock, &efds);
if (!driven_->drv_outgoing_empty(chid)) {
FD_SET(sock, &wfds);
}
}
@@ -291,7 +294,7 @@ public:
assert(status != SOCKET_ERROR);
for (auto &p : listen_sockets_) {
if (FD_ISSET(p.second, &rfds)) {
if (FD_ISSET(p.second, &rfds) || FD_ISSET(p.second, &efds)) {
accept_connections(p.first, p.second);
}
}
@@ -312,7 +315,7 @@ public:
}
}
}
if (FD_ISSET(sock, &rfds)) {
if (FD_ISSET(sock, &rfds) || FD_ISSET(sock, &efds)) {
int nrecv = recv(sock, chbuf.get(), 65536, 0);
if ((nrecv == SOCKET_ERROR) || (nrecv == 0)) {
close_socket(chid, "recv failure");