mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-06 04:35:29 +02:00
Fix HTTP connect on linux (need to ignore failed connections in the select)
This commit is contained in:
@@ -117,7 +117,13 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) {
|
||||
fd_util::SetNonBlocking(sock, true);
|
||||
|
||||
// Start trying to connect (async with timeout.)
|
||||
connect(sock, possible->ai_addr, (int)possible->ai_addrlen);
|
||||
errno = 0;
|
||||
if (connect(sock, possible->ai_addr, (int)possible->ai_addrlen) < 0) {
|
||||
if (errno != EINPROGRESS) {
|
||||
ERROR_LOG(HTTP, "connect(%d) call failed (%d: %s)", sock, errno, strerror(errno));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
sockets.push_back(sock);
|
||||
FD_SET(sock, &fds);
|
||||
if (maxfd < sock + 1) {
|
||||
@@ -125,6 +131,11 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) {
|
||||
}
|
||||
}
|
||||
|
||||
if (sockets.empty()) {
|
||||
ERROR_LOG(HTTP, "No resolved address would connect!");
|
||||
// TODO: What do we do here?
|
||||
}
|
||||
|
||||
int selectResult = 0;
|
||||
long timeoutHalfSeconds = floor(2 * timeout);
|
||||
while (timeoutHalfSeconds >= 0 && selectResult == 0) {
|
||||
|
||||
Reference in New Issue
Block a user