Skip to content

Commit

Permalink
Short timeout now also for Lunix
Browse files Browse the repository at this point in the history
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@10468 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
prissi committed Feb 7, 2022
1 parent a061603 commit 5dec365
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/simutrans/network/network.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ SOCKET network_open_address(char const* cp, char const*& err)
continue;
}
#else
if (fcntl(my_client_socket, F_SETFL, O_NONBLOCK) != 0) {
if (fcntl(my_client_socket, F_SETFL, fcntl(my_client_socket, F_GETFL, 0) | O_NONBLOCK) != 0) {
my_client_socket = INVALID_SOCKET;
continue;
}
Expand All @@ -329,7 +329,7 @@ SOCKET network_open_address(char const* cp, char const*& err)
time_out.tv_sec = 2; // 2 seconds or joining a server would not make sense
time_out.tv_usec = 0;

int ret = select(0, NULL, &setW, &setE, &time_out);
int ret = select(my_client_socket+1, NULL, &setW, &setE, &time_out);
if (ret <= 0) {
// select() failed or connection timed out
DBG_MESSAGE("network_open_address()", "Could not connect using this socket. select() Error: \"%s\"", strerror(GET_LAST_ERROR()));
Expand Down

0 comments on commit 5dec365

Please sign in to comment.