diff svr-main.c @ 1069:2fa71c3b2827 pam

merge pam branch up to date
author Matt Johnston <matt@ucc.asn.au>
date Mon, 16 Mar 2015 21:34:05 +0800
parents a00303a7d247
children 2265d7ebfdeb
line wrap: on
line diff
--- a/svr-main.c	Fri Jan 23 22:32:49 2015 +0800
+++ b/svr-main.c	Mon Mar 16 21:34:05 2015 +0800
@@ -138,7 +138,6 @@
 	}
 
 	for (i = 0; i < listensockcount; i++) {
-		set_sock_priority(listensocks[i], DROPBEAR_PRIO_LOWDELAY);
 		FD_SET(listensocks[i], &fds);
 	}
 
@@ -343,6 +342,7 @@
 
 	sa_chld.sa_handler = sigchld_handler;
 	sa_chld.sa_flags = SA_NOCLDSTOP;
+	sigemptyset(&sa_chld.sa_mask);
 	if (sigaction(SIGCHLD, &sa_chld, NULL) < 0) {
 		dropbear_exit("signal() error");
 	}
@@ -402,9 +402,9 @@
 }
 
 /* Set up listening sockets for all the requested ports */
-static size_t listensockets(int *sock, size_t sockcount, int *maxfd) {
-	
-	unsigned int i;
+static size_t listensockets(int *socks, size_t sockcount, int *maxfd) {
+
+	unsigned int i, n;
 	char* errstring = NULL;
 	size_t sockpos = 0;
 	int nsock;
@@ -415,7 +415,7 @@
 
 		TRACE(("listening on '%s:%s'", svr_opts.addresses[i], svr_opts.ports[i]))
 
-		nsock = dropbear_listen(svr_opts.addresses[i], svr_opts.ports[i], &sock[sockpos], 
+		nsock = dropbear_listen(svr_opts.addresses[i], svr_opts.ports[i], &socks[sockpos], 
 				sockcount - sockpos,
 				&errstring, maxfd);
 
@@ -426,6 +426,14 @@
 			continue;
 		}
 
+		for (n = 0; n < (unsigned int)nsock; n++) {
+			int sock = socks[sockpos + n];
+			set_sock_priority(sock, DROPBEAR_PRIO_LOWDELAY);
+#ifdef DROPBEAR_TCP_FAST_OPEN
+			set_listen_fast_open(sock);
+#endif
+		}
+
 		sockpos += nsock;
 
 	}