comparison netio.c @ 1295:750ec4ec4cbe

Convert #ifdef to #if, other build changes
author Matt Johnston <matt@ucc.asn.au>
date Wed, 04 May 2016 15:33:40 +0200
parents 57d09741d46d
children 251c5f7a6e96
comparison
equal deleted inserted replaced
1294:56aba7dedbea 1295:750ec4ec4cbe
51 51
52 static void connect_try_next(struct dropbear_progress_connection *c) { 52 static void connect_try_next(struct dropbear_progress_connection *c) {
53 struct addrinfo *r; 53 struct addrinfo *r;
54 int res = 0; 54 int res = 0;
55 int fastopen = 0; 55 int fastopen = 0;
56 #ifdef DROPBEAR_CLIENT_TCP_FAST_OPEN 56 #if DROPBEAR_CLIENT_TCP_FAST_OPEN
57 struct msghdr message; 57 struct msghdr message;
58 #endif 58 #endif
59 59
60 for (r = c->res_iter; r; r = r->ai_next) 60 for (r = c->res_iter; r; r = r->ai_next)
61 { 61 {
68 68
69 ses.maxfd = MAX(ses.maxfd, c->sock); 69 ses.maxfd = MAX(ses.maxfd, c->sock);
70 set_sock_nodelay(c->sock); 70 set_sock_nodelay(c->sock);
71 setnonblocking(c->sock); 71 setnonblocking(c->sock);
72 72
73 #ifdef DROPBEAR_CLIENT_TCP_FAST_OPEN 73 #if DROPBEAR_CLIENT_TCP_FAST_OPEN
74 fastopen = (c->writequeue != NULL); 74 fastopen = (c->writequeue != NULL);
75 75
76 if (fastopen) { 76 if (fastopen) {
77 memset(&message, 0x0, sizeof(message)); 77 memset(&message, 0x0, sizeof(message));
78 message.msg_name = r->ai_addr; 78 message.msg_name = r->ai_addr;
288 /* disable nagle */ 288 /* disable nagle */
289 val = 1; 289 val = 1;
290 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val)); 290 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val));
291 } 291 }
292 292
293 #ifdef DROPBEAR_SERVER_TCP_FAST_OPEN 293 #if DROPBEAR_SERVER_TCP_FAST_OPEN
294 void set_listen_fast_open(int sock) { 294 void set_listen_fast_open(int sock) {
295 int qlen = MAX(MAX_UNAUTH_PER_IP, 5); 295 int qlen = MAX(MAX_UNAUTH_PER_IP, 5);
296 if (setsockopt(sock, SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen)) != 0) { 296 if (setsockopt(sock, SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen)) != 0) {
297 TRACE(("set_listen_fast_open failed for socket %d: %s", sock, strerror(errno))) 297 TRACE(("set_listen_fast_open failed for socket %d: %s", sock, strerror(errno)))
298 } 298 }