mirror of
https://github.com/clearml/dropbear
synced 2025-01-31 19:07:28 +00:00
get rid of some unnecessary code
--HG-- branch : fastopen
This commit is contained in:
parent
c53ca6ebc0
commit
46845fd3e8
35
netio.c
35
netio.c
@ -71,13 +71,9 @@ static void connect_try_next(struct dropbear_progress_connection *c) {
|
|||||||
int res = 0;
|
int res = 0;
|
||||||
int fastopen = 0;
|
int fastopen = 0;
|
||||||
#ifdef DROPBEAR_TCP_FAST_OPEN
|
#ifdef DROPBEAR_TCP_FAST_OPEN
|
||||||
struct msghdr message;
|
struct msghdr message;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!c->res_iter) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (r = c->res_iter; r; r = r->ai_next)
|
for (r = c->res_iter; r; r = r->ai_next)
|
||||||
{
|
{
|
||||||
assert(c->sock == -1);
|
assert(c->sock == -1);
|
||||||
@ -88,6 +84,7 @@ static void connect_try_next(struct dropbear_progress_connection *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ses.maxfd = MAX(ses.maxfd, c->sock);
|
ses.maxfd = MAX(ses.maxfd, c->sock);
|
||||||
|
set_sock_nodelay(c->sock);
|
||||||
setnonblocking(c->sock);
|
setnonblocking(c->sock);
|
||||||
|
|
||||||
#if defined(__linux__) && defined(TCP_DEFER_ACCEPT)
|
#if defined(__linux__) && defined(TCP_DEFER_ACCEPT)
|
||||||
@ -114,9 +111,7 @@ static void connect_try_next(struct dropbear_progress_connection *c) {
|
|||||||
c->writequeue = NULL;
|
c->writequeue = NULL;
|
||||||
}
|
}
|
||||||
m_free(message.msg_iov);
|
m_free(message.msg_iov);
|
||||||
if (res > 0) {
|
packet_queue_consume(c->writequeue, res);
|
||||||
packet_queue_consume(c->writequeue, res);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -126,10 +121,12 @@ static void connect_try_next(struct dropbear_progress_connection *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (res < 0 && errno != EINPROGRESS) {
|
if (res < 0 && errno != EINPROGRESS) {
|
||||||
|
/* failure */
|
||||||
close(c->sock);
|
close(c->sock);
|
||||||
c->sock = -1;
|
c->sock = -1;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
/* new connection was successful, wait for it to complete */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,28 +136,6 @@ static void connect_try_next(struct dropbear_progress_connection *c) {
|
|||||||
} else {
|
} else {
|
||||||
c->res_iter = NULL;
|
c->res_iter = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->sock >= 0 || (errno == EINPROGRESS)) {
|
|
||||||
/* Success */
|
|
||||||
set_sock_nodelay(c->sock);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (!c->res_iter)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
/* XXX - returning error message through */
|
|
||||||
#if 0
|
|
||||||
/* Failed */
|
|
||||||
if (errstring != NULL && *errstring == NULL) {
|
|
||||||
int len;
|
|
||||||
len = 20 + strlen(strerror(err));
|
|
||||||
*errstring = (char*)m_malloc(len);
|
|
||||||
snprintf(*errstring, len, "Error connecting: %s", strerror(err));
|
|
||||||
}
|
|
||||||
TRACE(("Error connecting: %s", strerror(err)))
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Connect via TCP to a host. */
|
/* Connect via TCP to a host. */
|
||||||
|
Loading…
Reference in New Issue
Block a user