diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/inet.c | 4 | ||||
-rw-r--r-- | src/tcp.c | 4 |
2 files changed, 4 insertions, 4 deletions
@@ -423,8 +423,8 @@ const char *inet_tryconnect(p_socket ps, int *family, const char *address, | |||
423 | /* try connecting to remote address */ | 423 | /* try connecting to remote address */ |
424 | err = socket_strerror(socket_connect(ps, (SA *) iterator->ai_addr, | 424 | err = socket_strerror(socket_connect(ps, (SA *) iterator->ai_addr, |
425 | (socklen_t) iterator->ai_addrlen, tm)); | 425 | (socklen_t) iterator->ai_addrlen, tm)); |
426 | /* if success, break out of loop */ | 426 | /* if success or timeout is zero, break out of loop */ |
427 | if (err == NULL) { | 427 | if (err == NULL || timeout_iszero(tm)) { |
428 | *family = current_family; | 428 | *family = current_family; |
429 | break; | 429 | break; |
430 | } | 430 | } |
@@ -417,7 +417,7 @@ static int global_connect(lua_State *L) { | |||
417 | bindhints.ai_family = family; | 417 | bindhints.ai_family = family; |
418 | bindhints.ai_flags = AI_PASSIVE; | 418 | bindhints.ai_flags = AI_PASSIVE; |
419 | if (localaddr) { | 419 | if (localaddr) { |
420 | err = inet_trybind(&tcp->sock, &tcp->family, localaddr, | 420 | err = inet_trybind(&tcp->sock, &tcp->family, localaddr, |
421 | localserv, &bindhints); | 421 | localserv, &bindhints); |
422 | if (err) { | 422 | if (err) { |
423 | lua_pushnil(L); | 423 | lua_pushnil(L); |
@@ -429,7 +429,7 @@ static int global_connect(lua_State *L) { | |||
429 | memset(&connecthints, 0, sizeof(connecthints)); | 429 | memset(&connecthints, 0, sizeof(connecthints)); |
430 | connecthints.ai_socktype = SOCK_STREAM; | 430 | connecthints.ai_socktype = SOCK_STREAM; |
431 | /* make sure we try to connect only to the same family */ | 431 | /* make sure we try to connect only to the same family */ |
432 | connecthints.ai_family = tcp->family; | 432 | connecthints.ai_family = tcp->family; |
433 | err = inet_tryconnect(&tcp->sock, &tcp->family, remoteaddr, remoteserv, | 433 | err = inet_tryconnect(&tcp->sock, &tcp->family, remoteaddr, remoteserv, |
434 | &tcp->tm, &connecthints); | 434 | &tcp->tm, &connecthints); |
435 | if (err) { | 435 | if (err) { |