Commit 0f62172d authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(check_kill_flg): Use the new kill_status field of Connection instead

	of the old kill_pending field.
(read_from_connection): Ditto.
(add_to_kill_list): Ditto.  Don't add the client if it is dying.
(dns_resolution): If the DNS resolution completed the handshake,
	dump out the connections again to reflect that fact.
parent 5e62b985
/*
* $Id: connections.c,v 0.127 2003/08/22 09:01:03 ceder Exp $
* $Id: connections.c,v 0.128 2003/08/22 20:33:54 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -547,14 +547,29 @@ add_to_kill_list(Connection *conn)
oop_source *source;
int i;
if (conn->kill_pending)
switch (conn->kill_status)
{
case ks_pending:
/* A kill is already pending. Do nothing--but check that the
the client really is present on the kill_list. */
for (i = 0; i < kill_list_size; i++)
if (kill_list[i] == conn->session_no)
return;
restart_kom("add_to_kill_list(): kill_pending set but not on list.\n");
return;
case ks_dying:
/* Don't add this client to the kill list while it is being
killed. */
return;
case ks_none:
/* The normal case. Do all the work below. */
break;
}
/* Check that the client isn't already present on the kill_list. */
for (i = 0; i < kill_list_size; i++)
if (kill_list[i] == conn->session_no)
restart_kom("add_to_kill_list(): on list but not kill_pending.\n");
......@@ -574,7 +589,7 @@ add_to_kill_list(Connection *conn)
}
kill_list[kill_list_size-1] = conn->session_no;
conn->kill_pending = TRUE;
conn->kill_status = ks_pending;
if (!kill_pending)
{
......@@ -677,8 +692,8 @@ check_kill_flg(oop_source *UNUSED(source),
}
else
{
assert(conn->kill_pending);
conn->kill_pending = FALSE;
assert(conn->kill_status == ks_pending);
conn->kill_status = ks_dying;
logout_client(conn);
end_of_atomic();
changed = TRUE;
......@@ -782,6 +797,9 @@ dns_resolution(struct isc_scb *scb,
if (hostname != NULL)
string_free(hostname);
if (handshake_ok(conn, 0))
dump_connections();
return OOP_CONTINUE;
}
......@@ -935,18 +953,18 @@ read_from_connection(Connection *conn)
adjust_penalty(conn);
while (!would_block && !go_and_die && conn->penalty < param.max_penalty
&& !conn->kill_pending && !conn->blocked_by_dns)
&& conn->kill_status == ks_none && !conn->blocked_by_dns)
{
pre = s_strlen(conn->unparsed) - conn->first_to_parse;
while (conn->more_to_parse
&& !go_and_die && conn->penalty < param.max_penalty
&& !conn->kill_pending && !conn->blocked_by_dns)
&& conn->kill_status == ks_none && !conn->blocked_by_dns)
need_flush |= parse_unparsed(conn);
update_stat(STAT_RECV_QUEUE,
s_strlen(conn->unparsed) - conn->first_to_parse - pre);
if (go_and_die || conn->penalty >= param.max_penalty
|| conn->kill_pending || conn->blocked_by_dns)
|| conn->kill_status != ks_none || conn->blocked_by_dns)
break;
if (!conn->more_to_parse)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment