diff dbutil.c @ 1023:a00303a7d247 fastopen

tcp fastopen for the server
author Matt Johnston <matt@ucc.asn.au>
date Sun, 15 Feb 2015 22:34:05 +0800
parents 4121ca987e6a
children aac0095dc3b4
line wrap: on
line diff
--- a/dbutil.c	Sat Feb 14 09:56:11 2015 +0800
+++ b/dbutil.c	Sun Feb 15 22:34:05 2015 +0800
@@ -221,6 +221,16 @@
 	setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val));
 }
 
+#ifdef DROPBEAR_TCP_FAST_OPEN
+void set_listen_fast_open(int sock) {
+	int qlen = MAX(MAX_UNAUTH_PER_IP, 5);
+	if (setsockopt(sock, SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen)) != 0) {
+		TRACE(("set_listen_fast_open failed for socket %d: %s", sock, strerror(errno)))
+	}
+}
+
+#endif
+
 void set_sock_priority(int sock, enum dropbear_prio prio) {
 
 	int iptos_val = 0, so_prio_val = 0, rc;