Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
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) Tue Apr 14 17:21:26 1992 Per Cederqvist (ceder@lysator)
* Version 1.1.2 (not released). * 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. * Copyright (C) 1991 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* Created by Willf|r 31/3-90. Mostly written by ceder. * 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> #include <errno.h>
...@@ -67,7 +67,7 @@ static char *rcsid = "$Id: connections.c,v 0.16 1992/04/11 20:02:20 ceder Exp $" ...@@ -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 "internal-connections.h"
#include "rfc931.h" #include "rfc931.h"
ISCMCB * kom_server_mcb = NULL; IscMaster * kom_server_mcb = NULL;
Connection * active_connection = NULL; Connection * active_connection = NULL;
/* /*
...@@ -401,7 +401,7 @@ mux_handle_packet(Mux *mux) ...@@ -401,7 +401,7 @@ mux_handle_packet(Mux *mux)
cp->session_no, cp->session_no,
(int)cp->hostname.len, (int)cp->hostname.len,
cp->hostname.string, cp->hostname.string,
mux->scb->info.tcp.hostname)); isc_gethostname(mux->scb->info.tcp.raddr, NULL, 0)));
BUG((" is connecting]\n")); BUG((" is connecting]\n"));
break; break;
...@@ -419,7 +419,7 @@ mux_handle_packet(Mux *mux) ...@@ -419,7 +419,7 @@ mux_handle_packet(Mux *mux)
BUG(("\n[Client %d via MUX(%s)", BUG(("\n[Client %d via MUX(%s)",
cp->session_no, cp->session_no,
mux->scb->info.tcp.hostname)); isc_gethostname(mux->scb->info.tcp.raddr, NULL, 0)));
BUG((" is logging out by request]\n")); BUG((" is logging out by request]\n"));
add_to_kill_list(cp); add_to_kill_list(cp);
...@@ -464,13 +464,13 @@ mux_logout(Mux *mp) ...@@ -464,13 +464,13 @@ mux_logout(Mux *mp)
{ {
BUG(("\n[Client %d via MUX(%s)", BUG(("\n[Client %d via MUX(%s)",
mp->client_v[i].conn->session_no, 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")); BUG((" is logging out by MUX shutdown]\n"));
logout_client(mp->client_v[i].conn); logout_client(mp->client_v[i].conn);
end_of_atomic(FALSE); end_of_atomic(FALSE);
} }
isc_close(mp->scb); isc_destroy(kom_server_mcb, mp->scb);
mux_destruct(mp); mux_destruct(mp);
} }
...@@ -639,6 +639,16 @@ int kill_list_size = 0; ...@@ -639,6 +639,16 @@ int kill_list_size = 0;
void void
add_to_kill_list(Connection *conn) 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 == NULL)
{ {
if (kill_list_size != 0) if (kill_list_size != 0)
...@@ -694,7 +704,7 @@ check_kill_flg(void) ...@@ -694,7 +704,7 @@ check_kill_flg(void)
} }
static void static void
login_request(ISCECB *event) login_request(IscEvent *event)
{ {
Connection * cp; Connection * cp;
char *realuser; char *realuser;
...@@ -704,7 +714,7 @@ login_request(ISCECB *event) ...@@ -704,7 +714,7 @@ login_request(ISCECB *event)
BUG(("Connection attempt rejected.\n")); BUG(("Connection attempt rejected.\n"));
isc_printf(event->session, "%s", "%% No connections left.\n"); isc_printf(event->session, "%s", "%% No connections left.\n");
isc_flush(event->session); isc_flush(event->session);
isc_close(event->session); isc_destroy(kom_server_mcb, event->session);
async_rejected_connection(); async_rejected_connection();
return; return;
...@@ -715,11 +725,11 @@ login_request(ISCECB *event) ...@@ -715,11 +725,11 @@ login_request(ISCECB *event)
{ {
isc_printf(event->session, "%s", "%% No logins allowed.\n"); isc_printf(event->session, "%s", "%% No logins allowed.\n");
isc_flush(event->session); isc_flush(event->session);
isc_close(event->session); isc_destroy(kom_server_mcb, event->session);
return; return;
} }
if (event->session->info.tcp.listen == listen_mux) if (event->session == listen_mux)
{ {
/* Multiplexer requesting connection */ /* Multiplexer requesting connection */
...@@ -729,7 +739,8 @@ login_request(ISCECB *event) ...@@ -729,7 +739,8 @@ login_request(ISCECB *event)
event->session->udg = mux_create(MUX_TYPE_MUX, event->session); event->session->udg = mux_create(MUX_TYPE_MUX, event->session);
BUG(("MUX #%d at %s connecting.\n", 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 else
{ {
...@@ -743,7 +754,9 @@ login_request(ISCECB *event) ...@@ -743,7 +754,9 @@ login_request(ISCECB *event)
cp = new_client(); cp = new_client();
cp->mux = event->session->udg; 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 /* Get the real user name, as returned by the Ident protocol
(rfc 931). */ (rfc 931). */
...@@ -754,20 +767,20 @@ login_request(ISCECB *event) ...@@ -754,20 +767,20 @@ login_request(ISCECB *event)
mux_addclient(event->session->udg, 0, cp); mux_addclient(event->session->udg, 0, cp);
BUG(("\n[Client %d from %s", cp->session_no, 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")); BUG((" is connecting]\n"));
} }
} }
static void static void
logout_request(ISCECB *event) logout_request(IscEvent *event)
{ {
Connection * cp; Connection * cp;
if (event->session->udg->type == MUX_TYPE_MUX) if (event->session->udg->type == MUX_TYPE_MUX)
{ {
BUG(("\n[MUX #%d at %s", (int)event->session, 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")); BUG((" is logging out]\n"));
/* /*
...@@ -780,7 +793,7 @@ logout_request(ISCECB *event) ...@@ -780,7 +793,7 @@ logout_request(ISCECB *event)
cp = event->session->udg->client_v[0].conn; cp = event->session->udg->client_v[0].conn;
BUG(("\n[Client %d from %s", cp->session_no, 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")); BUG((" is logging out]\n"));
add_to_kill_list(cp); add_to_kill_list(cp);
...@@ -789,7 +802,7 @@ logout_request(ISCECB *event) ...@@ -789,7 +802,7 @@ logout_request(ISCECB *event)
static void static void
message_request(ISCECB *event) message_request(IscEvent *event)
{ {
Connection *cp; Connection *cp;
String tmp_str; String tmp_str;
...@@ -825,7 +838,7 @@ timevaldiff(struct timeval a, ...@@ -825,7 +838,7 @@ timevaldiff(struct timeval a,
void void
toploop(void) toploop(void)
{ {
ISCECB * event; IscEvent * event;
Bool pending_input = TRUE; /* Should be TRUE whenever there Bool pending_input = TRUE; /* Should be TRUE whenever there
is or might be pending input is or might be pending input
from any client in the unparsed from any client in the unparsed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment