Skip to content

Commit 53915b9

Browse files
ddunsmuir0-8-15
authored andcommitted
HTTPSCLIENT: Fixed really long wait when failing to connect on Android, reduced to timeout of 3 seconds.
1 parent 4e0c46d commit 53915b9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

modules/httpsclient/httpsclient.scm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,16 @@ static int httpsclient_open(char *host, int port, int use_keys, char *cert, char
9797
return 0;
9898
}
9999
if (addr == NULL) { return 0; }
100+
100101
s = socket(addr->ai_family, SOCK_STREAM, 0);
102+
103+
#ifndef WIN32
104+
struct timeval timeout;
105+
timeout.tv_sec = 3;
106+
timeout.tv_usec = 0;
107+
setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout));
108+
#endif
109+
101110
if (s < 0) { return 0; }
102111
if (connect(s, addr->ai_addr, (int)addr->ai_addrlen) != 0) {
103112
if (errno==EINTR) {

0 commit comments

Comments
 (0)