changeset 1191:b370b4b172d0

Fix ses.channel_signal_pending race
author Matt Johnston <matt@ucc.asn.au>
date Fri, 27 Nov 2015 21:26:43 +0800
parents 6ae081e631db
children af940cefdba1
files common-channel.c common-session.c
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/common-channel.c	Thu Nov 26 23:15:27 2015 +0800
+++ b/common-channel.c	Fri Nov 27 21:26:43 2015 +0800
@@ -255,8 +255,6 @@
 		}
 	}
 
-	ses.channel_signal_pending = 0;
-
 #ifdef USING_LISTENERS
 	handle_listeners(readfds);
 #endif
--- a/common-session.c	Thu Nov 26 23:15:27 2015 +0800
+++ b/common-session.c	Fri Nov 27 21:26:43 2015 +0800
@@ -162,6 +162,7 @@
 		/* We get woken up when signal handlers write to this pipe.
 		   SIGCHLD in svr-chansession is the only one currently. */
 		FD_SET(ses.signal_pipe[0], &readfd);
+		ses.channel_signal_pending = 0;
 
 		/* set up for channels which can be read/written */
 		setchannelfds(&readfd, &writefd, writequeue_has_space);
@@ -211,7 +212,9 @@
 		wake up the select() above. */
 		if (FD_ISSET(ses.signal_pipe[0], &readfd)) {
 			char x;
+			TRACE(("signal pipe set"))
 			while (read(ses.signal_pipe[0], &x, 1) > 0) {}
+			ses.channel_signal_pending = 1;
 		}
 
 		/* check for auth timeout, rekeying required etc */