diff --git a/src/server/ChangeLog b/src/server/ChangeLog
index 3768ccc5d0806b103f2553c25b3e7dc4a9476507..87abc5430e349316b9dd044f6ce6489a5b133534 100644
--- a/src/server/ChangeLog
+++ b/src/server/ChangeLog
@@ -1,3 +1,17 @@
+Fri Apr 10 13:46:41 1992  Per Cederqvist  (ceder@lysator)
+
+	* Since lyskomd spended 25% of the time in check_kill_flag it was
+	rewritten. Instead of having a flag in the Connection that is
+	checked once after every atomic call a linked list of connections
+	that shall be killed is created.
+	* connections.h (Connection): The field kill_me deleted.
+	* connections.[hc] (add_to_kill_list): New function.
+	* connections.c (kill_list_size): New variables.
+	* connections.c (check_kill_flg): Rewritten to use the kill_list.
+	* internal-connections.c (EMPTY_CONNECTION, new_client): Don't try
+	to initialize kill_me.
+	* session.c (disconnect): Use add_to_kill_list() instead of kill_me.
+
 Thu Apr  9 00:15:33 1992  Per Cederqvist  (ceder@lysator)
 
 	* Version 1.1.1 (not released).
diff --git a/src/server/connections.c b/src/server/connections.c
index d32a520f09c9d317b13529cd883cf29f8282fab6..6dc5c745dfc613b07802b16018e567ebc0ecce54 100644
--- a/src/server/connections.c
+++ b/src/server/connections.c
@@ -1,5 +1,5 @@
 /*
- * $Id: connections.c,v 0.14 1992/04/04 17:26:09 ceder Exp $
+ * $Id: connections.c,v 0.15 1992/04/10 11:56:30 ceder Exp $
  * Copyright (C) 1991  Lysator Academic Computer Association.
  *
  * This file is part of the LysKOM server.
@@ -30,7 +30,7 @@
  * Created by Willf|r 31/3-90. Mostly written by ceder.
  */
 
-static char *rcsid = "$Id: connections.c,v 0.14 1992/04/04 17:26:09 ceder Exp $";
+static char *rcsid = "$Id: connections.c,v 0.15 1992/04/10 11:56:30 ceder Exp $";
 
 
 #include <errno.h>
@@ -328,7 +328,7 @@ parse_unparsed(Connection *client)
 	break;
 
     case ISC_LOGOUT:
-	client->kill_me = TRUE;
+	add_to_kill_list(client);
 	break;
     }
     
@@ -422,12 +422,7 @@ mux_handle_packet(Mux *mux)
 	     mux->scb->info.tcp.hostname));
 	BUG((" is logging out by request]\n"));
 
-#if 0
-	logout_client(cp);
-	end_of_atomic(FALSE);	/* ??? */
-#else
-	cp->kill_me = TRUE;
-#endif
+	add_to_kill_list(cp);
 	break;
 
     case 3:			/* msg */
@@ -635,6 +630,31 @@ dump_statistics(void)
     last_dump = now;
 }
 
+/* List of connections to kill. */
+
+Session_no *kill_list = NULL;
+int kill_list_size = 0;
+
+/* Schedule this client for termination. */
+void
+add_to_kill_list(Connection *conn)
+{
+    if (kill_list == NULL)
+    {
+	if (kill_list_size != 0)
+	    restart_kom("add_to_kill_list(): size = %d\n", kill_list_size);
+
+	kill_list_size = 1;
+	kill_list = smalloc(sizeof(Session_no));
+    }
+    else
+    {
+	kill_list_size++;
+	kill_list = srealloc(kill_list, kill_list_size * sizeof(Session_no));
+    }
+
+    kill_list[kill_list_size-1] = conn->session_no;
+}
 
 /*
  * check_kill_flg must NEVER be called inside an atomic call!
@@ -642,7 +662,6 @@ dump_statistics(void)
 static void
 check_kill_flg(void)
 {
-    Session_no  i = 0;
     Connection *conn;
 
     if ( active_connection != NULL )
@@ -651,16 +670,24 @@ check_kill_flg(void)
 		    active_connection->session_no);
     }
 
-    while ( (i = traverse_connections (i)) != 0 )
+    while (kill_list_size > 0)
     {
-	conn = get_conn_by_number(i);
-
-	if ( conn->kill_me == TRUE )
+	--kill_list_size;
+	conn = get_conn_by_number (kill_list[kill_list_size]);
+	if (conn == NULL)
 	{
-	    logout_client(conn);
-	    end_of_atomic(FALSE);
+	    log("check_kill_flg(): Connection %d doesn't exist.\n",
+		kill_list[kill_list_size]);
+	}
+	else
+	{
+	    logout_client (conn);
+	    end_of_atomic (FALSE);
 	}
     }
+
+    sfree (kill_list);
+    kill_list = NULL;
 }
 
 static void
@@ -753,7 +780,7 @@ logout_request(ISCECB *event)
 	     event->session->info.tcp.hostname));
 	BUG((" is logging out]\n"));
 	      
-	cp->kill_me = TRUE;
+	add_to_kill_list(cp);
     }
 }
 
diff --git a/src/server/connections.h b/src/server/connections.h
index a282389a1814f1c596975bdc969f2128be4b8d6a..180c5d4b0b795988b60fd35627dbab57a15b723d 100644
--- a/src/server/connections.h
+++ b/src/server/connections.h
@@ -1,5 +1,5 @@
 /*
- * $Id: connections.h,v 0.9 1992/04/04 17:26:49 ceder Exp $
+ * $Id: connections.h,v 0.10 1992/04/10 11:56:32 ceder Exp $
  * Copyright (C) 1991  Lysator Academic Computer Association.
  *
  * This file is part of the LysKOM server.
@@ -23,7 +23,7 @@
  * Please mail bug reports to bug-lyskom@lysator.liu.se. 
  */
 /*
- * $Id: connections.h,v 0.9 1992/04/04 17:26:49 ceder Exp $
+ * $Id: connections.h,v 0.10 1992/04/10 11:56:32 ceder Exp $
  *
   * connections.h -- The top level of the communication packet.
   *
@@ -101,7 +101,6 @@ typedef struct connection {
 					    received from the client. */
     
     Session_no		session_no;      /* A unique number. */
-    Bool                kill_me;        /* Yeah! */
 } Connection;
 /*
  * It is guaranteed that in the Connection struct the pers_no and person 
@@ -217,3 +216,7 @@ dump_statistics(void);
 
 extern void
 logout_all_clients(void);
+
+extern void
+add_to_kill_list(Connection *conn);
+
diff --git a/src/server/internal-connections.c b/src/server/internal-connections.c
index 68325f0d719ef80e04f6a996d8744bc0efc4e6bb..b3c7e9f763d4c697ac6b8d2d4c94be3ec25aee60 100644
--- a/src/server/internal-connections.c
+++ b/src/server/internal-connections.c
@@ -1,5 +1,5 @@
 /*
- * $Id: internal-connections.c,v 0.8 1992/04/01 20:50:42 ceder Exp $
+ * $Id: internal-connections.c,v 0.9 1992/04/10 11:56:34 ceder Exp $
  * Copyright (C) 1991  Lysator Academic Computer Association.
  *
  * This file is part of the LysKOM server.
@@ -28,7 +28,7 @@
  * Abstract routines on the data type Connection.
  */
 
-static char *rcsid = "$Id: internal-connections.c,v 0.8 1992/04/01 20:50:42 ceder Exp $";
+static char *rcsid = "$Id: internal-connections.c,v 0.9 1992/04/10 11:56:34 ceder Exp $";
 
 
 #include "exp.h"
@@ -64,8 +64,7 @@ INTERNAL const Connection EMPTY_CONNECTION =
 		      NULL_CONF_TYPE_i, EMPTY_tm_i,
 		      /* Protocol independent... */
 		      EMPTY_STRING_i, 0, FALSE,
-		      NO_TIME,
-		      0, FALSE});
+		      NO_TIME, 0});
 
 static int  no_of_allocated_connections = 0;
 
@@ -119,7 +118,6 @@ new_client(void)
     c->username = EMPTY_STRING;
     c->ident_user = EMPTY_STRING;
     c->invisible = FALSE;
-    c->kill_me = FALSE;
 
     return c;
 }
diff --git a/src/server/session.c b/src/server/session.c
index fd06a5ffdc4154d4712710de0edbf57a5d03874c..56a9c898d3122d41e6385c65ced47b57216f4e52 100644
--- a/src/server/session.c
+++ b/src/server/session.c
@@ -1,5 +1,5 @@
 /*
- * $Id: session.c,v 0.9 1992/04/07 14:53:31 ceder Exp $
+ * $Id: session.c,v 0.10 1992/04/10 11:56:36 ceder Exp $
  * Copyright (C) 1991  Lysator Academic Computer Association.
  *
  * This file is part of the LysKOM server.
@@ -28,7 +28,7 @@
  * Session control and miscellaneous.
  */
 
-static char *rcsid = "$Id: session.c,v 0.9 1992/04/07 14:53:31 ceder Exp $";
+static char *rcsid = "$Id: session.c,v 0.10 1992/04/10 11:56:36 ceder Exp $";
 
 
 #include <time.h>
@@ -564,7 +564,7 @@ disconnect (Session_no session_no)
 	if ( is_supervisor(cptr->pers_no, NULL, ACTPERS, ACT_P)
 	    || session_no == active_connection->session_no )
 	{
-	    cptr->kill_me = TRUE;
+	    add_to_kill_list(cptr);
 	    return OK;
 	}
 	else