diff --git a/common-channel.c b/common-channel.c
index 5f4e92dea379377e8f93b8c503e9145893d781c5..8a1010583ec82a51de4f897f402b5820cb1df019 100644
--- a/common-channel.c
+++ b/common-channel.c
@@ -255,8 +255,6 @@ void channelio(fd_set *readfds, fd_set *writefds) {
 		}
 	}
 
-	ses.channel_signal_pending = 0;
-
 #ifdef USING_LISTENERS
 	handle_listeners(readfds);
 #endif
diff --git a/common-session.c b/common-session.c
index 96d747db2111d43ebaba7e26b9bec697dd40003b..874d5396a31533886755591ad00ac0a1149104af 100644
--- a/common-session.c
+++ b/common-session.c
@@ -162,6 +162,7 @@ void session_loop(void(*loophandler)()) {
 		/* 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 @@ void session_loop(void(*loophandler)()) {
 		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 */