diff options
author | Matt Johnston <matt@ucc.asn.au> | 2015-02-14 09:56:11 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2015-02-14 09:56:11 +0800 |
commit | 21f2af66311b1488fb1539c28eb8cd32fd74cd65 (patch) | |
tree | 04205885770a911989f45fa031271fd985a8793a /dbutil.c | |
parent | ec6ccd02c663e7b31f3d3ae17c0c6bcd23c66fac (diff) | |
download | dropbear-21f2af66311b1488fb1539c28eb8cd32fd74cd65.tar.gz |
connect_remote() is now always non-blocking
Diffstat (limited to 'dbutil.c')
-rw-r--r-- | dbutil.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -435,8 +435,7 @@ static void set_piggyback_ack(int sock) { * wasn't null, it will be a newly malloced error message */ /* TODO: maxfd */ -int connect_remote(const char* remotehost, const char* remoteport, - int nonblocking, char ** errstring) { +int connect_remote(const char* remotehost, const char* remoteport, char ** errstring) { struct addrinfo *res0 = NULL, *res = NULL, hints; int sock; @@ -475,16 +474,14 @@ int connect_remote(const char* remotehost, const char* remoteport, continue; } - if (nonblocking) { - setnonblocking(sock); + setnonblocking(sock); #if defined(__linux__) && defined(TCP_DEFER_ACCEPT) - set_piggyback_ack(sock); + set_piggyback_ack(sock); #endif - } if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) { - if (errno == EINPROGRESS && nonblocking) { + if (errno == EINPROGRESS) { TRACE(("Connect in progress")) break; } else { @@ -498,7 +495,7 @@ int connect_remote(const char* remotehost, const char* remoteport, break; /* Success */ } - if (sock < 0 && !(errno == EINPROGRESS && nonblocking)) { + if (sock < 0 && !(errno == EINPROGRESS)) { /* Failed */ if (errstring != NULL && *errstring == NULL) { int len; |