Commit 6ba301c9 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Use isc 0.97.

add_to_kill_list(): Check that the connection isn't already on the kill list.
parent be23e7f7
Thu Apr 16 00:46:50 1992 Per Cederqvist (ceder@lysator)
* Use isc-0.97:
* Makefile (LIBS): -lisc-new instead of -lold-isc.
* Makefile (GENOBJS, GEN_SRCS): Include isc-malloc.[oc].
* isc-malloc.[hc]: New files. (Compare string-malloc.[hc]).
* Various namechanges:
ISCMCB -> IscMaster
ISCECB -> IscEvent
ISCSCB -> IscSession
* Use isc_destroy() instead of isc_close().
* isc-interfacs.h: Include <isc-new.h> instead of <isc.h>.
* lyskomd.h (listen_client, listen_mux): Now (IscSession *).
Updated all references.
* lyskomd.h (kom_server_mcb): Now declared here.
* ramkomd.c ("isc-malloc.h"): Include instead of <isc-dump.h>.
* ramkomd.c (server_init): Use the new configuration scheme.
(Needs som further investigation).
* ramkomd.c (dump_exit_statistics): Don't
dump_isc_message_counts() since it doesn't exist.
Wed Apr 15 19:52:20 1992 Per Cederqvist (ceder@lysator)
* connections.c (add_to_kill_list): Check if the connection
already was on the kill-list. If so, print a diagnostic and
return.
Tue Apr 14 17:21:26 1992 Per Cederqvist (ceder@lysator)
* Version 1.1.2 (not released).
......
/*
* $Id: connections.c,v 0.16 1992/04/11 20:02:20 ceder Exp $
* $Id: connections.c,v 0.17 1992/04/15 22:58:48 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.16 1992/04/11 20:02:20 ceder Exp $";
static char *rcsid = "$Id: connections.c,v 0.17 1992/04/15 22:58:48 ceder Exp $";
#include <errno.h>
......@@ -67,7 +67,7 @@ static char *rcsid = "$Id: connections.c,v 0.16 1992/04/11 20:02:20 ceder Exp $"
#include "internal-connections.h"
#include "rfc931.h"
ISCMCB * kom_server_mcb = NULL;
IscMaster * kom_server_mcb = NULL;
Connection * active_connection = NULL;
/*
......@@ -401,7 +401,7 @@ mux_handle_packet(Mux *mux)
cp->session_no,
(int)cp->hostname.len,
cp->hostname.string,
mux->scb->info.tcp.hostname));
isc_gethostname(mux->scb->info.tcp.raddr, NULL, 0)));
BUG((" is connecting]\n"));
break;
......@@ -419,7 +419,7 @@ mux_handle_packet(Mux *mux)
BUG(("\n[Client %d via MUX(%s)",
cp->session_no,
mux->scb->info.tcp.hostname));
isc_gethostname(mux->scb->info.tcp.raddr, NULL, 0)));
BUG((" is logging out by request]\n"));
add_to_kill_list(cp);
......@@ -464,13 +464,13 @@ mux_logout(Mux *mp)
{
BUG(("\n[Client %d via MUX(%s)",
mp->client_v[i].conn->session_no,
mp->scb->info.tcp.hostname));
isc_gethostname(mp->scb->info.tcp.raddr, NULL, 0)));
BUG((" is logging out by MUX shutdown]\n"));
logout_client(mp->client_v[i].conn);
end_of_atomic(FALSE);
}
isc_close(mp->scb);
isc_destroy(kom_server_mcb, mp->scb);
mux_destruct(mp);
}
......@@ -639,6 +639,16 @@ int kill_list_size = 0;
void
add_to_kill_list(Connection *conn)
{
int i;
for (i = 0; i < kill_list_size; i++)
if (kill_list[kill_list_size] == conn->session_no)
{
log("add_to_kill_list(%d): already present as %d of %d.\n",
conn->session_no, i, kill_list_size);
return;
}
if (kill_list == NULL)
{
if (kill_list_size != 0)
......@@ -694,7 +704,7 @@ check_kill_flg(void)
}
static void
login_request(ISCECB *event)
login_request(IscEvent *event)
{
Connection * cp;
char *realuser;
......@@ -704,7 +714,7 @@ login_request(ISCECB *event)
BUG(("Connection attempt rejected.\n"));
isc_printf(event->session, "%s", "%% No connections left.\n");
isc_flush(event->session);
isc_close(event->session);
isc_destroy(kom_server_mcb, event->session);
async_rejected_connection();
return;
......@@ -715,11 +725,11 @@ login_request(ISCECB *event)
{
isc_printf(event->session, "%s", "%% No logins allowed.\n");
isc_flush(event->session);
isc_close(event->session);
isc_destroy(kom_server_mcb, event->session);
return;
}
if (event->session->info.tcp.listen == listen_mux)
if (event->session == listen_mux)
{
/* Multiplexer requesting connection */
......@@ -729,7 +739,8 @@ login_request(ISCECB *event)
event->session->udg = mux_create(MUX_TYPE_MUX, event->session);
BUG(("MUX #%d at %s connecting.\n",
(int)event->session, event->session->info.tcp.hostname));
(int)event->session,
isc_gethostname(event->session->info.tcp.raddr, NULL, 0)));
}
else
{
......@@ -743,7 +754,9 @@ login_request(ISCECB *event)
cp = new_client();
cp->mux = event->session->udg;
s_crea_str(&cp->hostname, event->session->info.tcp.hostname);
s_crea_str(&cp->hostname,
isc_gethostname(event->session->info.tcp.raddr,
NULL, 0));
/* Get the real user name, as returned by the Ident protocol
(rfc 931). */
......@@ -754,20 +767,20 @@ login_request(ISCECB *event)
mux_addclient(event->session->udg, 0, cp);
BUG(("\n[Client %d from %s", cp->session_no,
event->session->info.tcp.hostname));
isc_gethostname(event->session->info.tcp.raddr, NULL, 0)));
BUG((" is connecting]\n"));
}
}
static void
logout_request(ISCECB *event)
logout_request(IscEvent *event)
{
Connection * cp;
if (event->session->udg->type == MUX_TYPE_MUX)
{
BUG(("\n[MUX #%d at %s", (int)event->session,
event->session->info.tcp.hostname));
isc_gethostname(event->session->info.tcp.raddr, NULL, 0)));
BUG((" is logging out]\n"));
/*
......@@ -780,7 +793,7 @@ logout_request(ISCECB *event)
cp = event->session->udg->client_v[0].conn;
BUG(("\n[Client %d from %s", cp->session_no,
event->session->info.tcp.hostname));
isc_gethostname(event->session->info.tcp.raddr, NULL, 0)));
BUG((" is logging out]\n"));
add_to_kill_list(cp);
......@@ -789,7 +802,7 @@ logout_request(ISCECB *event)
static void
message_request(ISCECB *event)
message_request(IscEvent *event)
{
Connection *cp;
String tmp_str;
......@@ -825,7 +838,7 @@ timevaldiff(struct timeval a,
void
toploop(void)
{
ISCECB * event;
IscEvent * event;
Bool pending_input = TRUE; /* Should be TRUE whenever there
is or might be pending input
from any client in the unparsed
......
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