- markus@cvs.openbsd.org 2001/07/02 22:52:57
[channels.c channels.h serverloop.c]
improve cleanup/exit logic in ssh2:
stop listening to channels, detach channel users (e.g. sessions).
wait for children (i.e. dying sessions), send exit messages,
cleanup all channels.
diff --git a/serverloop.c b/serverloop.c
index 773292a..1db1c72 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: serverloop.c,v 1.73 2001/07/02 13:59:14 markus Exp $");
+RCSID("$OpenBSD: serverloop.c,v 1.74 2001/07/02 22:52:57 markus Exp $");
#include "xmalloc.h"
#include "packet.h"
@@ -711,7 +711,8 @@
* there is a race between channel_free_all() killing children and
* children dying before kill()
*/
- channel_free_all();
+ channel_detach_all();
+ channel_stop_listening();
while (session_have_children()) {
pid = waitpid(-1, &status, 0);
@@ -722,6 +723,7 @@
break;
}
}
+ channel_free_all();
}
static void