aboutsummaryrefslogtreecommitdiff
path: root/src/tcp.c
diff options
context:
space:
mode:
authorDiego Nehab <diego.nehab@gmail.com>2015-12-03 12:56:18 -0200
committerDiego Nehab <diego.nehab@gmail.com>2015-12-03 12:56:18 -0200
commit83880dbed77f9a0a3627bce2e7bfbe1b862e091d (patch)
treeb5c9dcf94fe311c27a42096c04907fcd17265404 /src/tcp.c
parentbe67f63f4e11e53690bf1431a236f86b484c9bf0 (diff)
downloadluasocket-83880dbed77f9a0a3627bce2e7bfbe1b862e091d.tar.gz
luasocket-83880dbed77f9a0a3627bce2e7bfbe1b862e091d.tar.bz2
luasocket-83880dbed77f9a0a3627bce2e7bfbe1b862e091d.zip
When zero-timeout, only try first address in connect.
Diffstat (limited to 'src/tcp.c')
-rw-r--r--src/tcp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tcp.c b/src/tcp.c
index cef9d16..e4f1a4b 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -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) {