Mercurial > dropbear
comparison netio.c @ 1076:d92597ef089e
fastopen code was totally broken
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 14 Apr 2015 20:43:54 +0800 |
parents | 88043f9d40bd |
children | b3b772646974 |
comparison
equal
deleted
inserted
replaced
1075:cc6116cc0b5c | 1076:d92597ef089e |
---|---|
70 struct addrinfo *r; | 70 struct addrinfo *r; |
71 int res = 0; | 71 int res = 0; |
72 int fastopen = 0; | 72 int fastopen = 0; |
73 #ifdef DROPBEAR_TCP_FAST_OPEN | 73 #ifdef DROPBEAR_TCP_FAST_OPEN |
74 struct msghdr message; | 74 struct msghdr message; |
75 struct iovec message; | |
76 #endif | 75 #endif |
77 | 76 |
78 for (r = c->res_iter; r; r = r->ai_next) | 77 for (r = c->res_iter; r; r = r->ai_next) |
79 { | 78 { |
80 dropbear_assert(c->sock == -1); | 79 dropbear_assert(c->sock == -1); |
100 message.msg_namelen = r->ai_addrlen; | 99 message.msg_namelen = r->ai_addrlen; |
101 | 100 |
102 if (c->writequeue) { | 101 if (c->writequeue) { |
103 /* 6 is arbitrary, enough to hold initial packets */ | 102 /* 6 is arbitrary, enough to hold initial packets */ |
104 int iovlen = 6; /* Linux msg_iovlen is a size_t */ | 103 int iovlen = 6; /* Linux msg_iovlen is a size_t */ |
105 struct iov[6]; | 104 struct iovec iov[6]; |
106 packet_queue_to_iovec(c->writequeue, iov, &iovlen); | 105 packet_queue_to_iovec(c->writequeue, iov, &iovlen); |
107 message.msg_iov = &iov; | 106 message.msg_iov = iov; |
108 message.msg_iovlen = iovlen; | 107 message.msg_iovlen = iovlen; |
109 res = sendmsg(c->sock, &message, MSG_FASTOPEN); | 108 res = sendmsg(c->sock, &message, MSG_FASTOPEN); |
110 if (res < 0 && errno != EINPROGRESS) { | 109 if (res < 0 && errno != EINPROGRESS) { |
111 m_free(c->errstring); | 110 m_free(c->errstring); |
112 c->errstring = m_strdup(strerror(errno)); | 111 c->errstring = m_strdup(strerror(errno)); |