mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix HTTP connect on linux (need to ignore failed connections in the select)
This commit is contained in:
parent
b6515ef1e6
commit
0421607c00
1 changed files with 12 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue