diff --git a/src/server/ChangeLog b/src/server/ChangeLog index 2d9baf53e6869ab9e7a764fee3aad3bc4b6bcffd..3d81ad022a06b6db5c73bdf8791c76874d6be8aa 100644 --- a/src/server/ChangeLog +++ b/src/server/ChangeLog @@ -1,3 +1,24 @@ +Mon May 25 22:56:38 1992 Per Cederqvist (ceder@lysator) + + * version.incl: Version 1.2.1 (not released). + + * server-config.c (TIMEOUT): Increased from 100 ms to 5 seconds. + With isc 0.97 that should be no problem! + + * connections.c (toploop): The timeout is initially zero, so that + the garbing starts right away. + + * connections.c (login_request): Fix so that the server can tell + the difference between a mux and a client (using num_ip_*_port) + (The bug was introduced with the isc upgrade). + * lyskomd.h (listen_client, listen_mux): No longer exported. + * ramkomd.c (listen_client, listen_mux): Now static. + * ramkomd.c, lyskomd.h (num_ip_client_port, num_ip_mux_port): New + variables. + * ramkomd.c (server_init): Really use the IscConfig struct. + * ramkomd.c (server_init): Log which ports lyskomd listens to for + clients and servers, and set num_ip_*_port. + Sat May 23 19:57:17 1992 Per Cederqvist (ceder@robin) * text.c (add_comment, add_footnote): Disallow texts to be diff --git a/src/server/connections.c b/src/server/connections.c index c80014533ed317348856adf91c6b9a162d076f77..6b830dc7e2071d370e7b11f8e3fd84ed092a9472 100644 --- a/src/server/connections.c +++ b/src/server/connections.c @@ -1,5 +1,5 @@ /* - * $Id: connections.c,v 0.17 1992/04/15 22:58:48 ceder Exp $ + * $Id: connections.c,v 0.18 1992/05/25 21:13:27 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.17 1992/04/15 22:58:48 ceder Exp $"; +static char *rcsid = "$Id: connections.c,v 0.18 1992/05/25 21:13:27 ceder Exp $"; #include <errno.h> @@ -708,6 +708,8 @@ login_request(IscEvent *event) { Connection * cp; char *realuser; + int localport; + IscAddress *isc_adr; if (isc_sessions(kom_server_mcb) >= MAX_NO_OF_CONNECTIONS) { @@ -729,7 +731,18 @@ login_request(IscEvent *event) return; } - if (event->session == listen_mux) + /* Find out if it is a mux or a client that tries to connect to + us. Do it by getting the local port number. */ + + isc_adr = isc_getladdress (event->session); + if (isc_adr == NULL) + restart_kom("login_request(): can't isc_getladdress (%lu)\n", + event->session); + + localport = isc_getportnum (isc_adr); + isc_freeaddress (isc_adr); + + if (localport == num_ip_mux_port) { /* Multiplexer requesting connection */ @@ -742,7 +755,7 @@ login_request(IscEvent *event) (int)event->session, isc_gethostname(event->session->info.tcp.raddr, NULL, 0))); } - else + else if (localport == num_ip_client_port) { /* Client requesting connection */ @@ -769,7 +782,12 @@ login_request(IscEvent *event) BUG(("\n[Client %d from %s", cp->session_no, isc_gethostname(event->session->info.tcp.raddr, NULL, 0))); BUG((" is connecting]\n")); - } + } + else + { + /* Help! It was neither a client, nor a mux. */ + restart_kom("login_request(): Neither client, nor mux.\n"); + } } static void @@ -843,7 +861,9 @@ toploop(void) is or might be pending input from any client in the unparsed buffer. */ - long timeout = TIMEOUT; /* In milliseconds. */ + long timeout = 0; /* In milliseconds. Start with a + small value since we should + start garbing right away. */ struct timeval before, after; while ( !go_and_die ) diff --git a/src/server/lyskomd.h b/src/server/lyskomd.h index e4ec94b0cd515a501a0d9bb3eb672ded41ca72ab..173088b27e3f1ccb0f35ff2a254e490b60d8d261 100644 --- a/src/server/lyskomd.h +++ b/src/server/lyskomd.h @@ -1,5 +1,5 @@ /* - * $Id: lyskomd.h,v 0.4 1992/04/15 22:59:20 ceder Exp $ + * $Id: lyskomd.h,v 0.5 1992/05/25 21:13:29 ceder Exp $ * Copyright (C) 1991 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -23,13 +23,13 @@ * Please mail bug reports to bug-lyskom@lysator.liu.se. */ /* - * $Id: lyskomd.h,v 0.4 1992/04/15 22:59:20 ceder Exp $ + * $Id: lyskomd.h,v 0.5 1992/05/25 21:13:29 ceder Exp $ */ /* Defined in ramkomd.c */ -extern struct isc_scb *listen_client; -extern struct isc_scb *listen_mux; +extern int num_ip_client_port; +extern int num_ip_mux_port; /* Defined in connections.c */ extern struct isc_mcb * kom_server_mcb; diff --git a/src/server/ramkomd.c b/src/server/ramkomd.c index 465d885c67c717caf8a1f595a365d9493f0ab1f5..46acba3455f78727303839d78f3f328ffc239479 100644 --- a/src/server/ramkomd.c +++ b/src/server/ramkomd.c @@ -1,5 +1,5 @@ /* - * $Id: ramkomd.c,v 0.28 1992/04/15 22:59:23 ceder Exp $ + * $Id: ramkomd.c,v 0.29 1992/05/25 21:13:31 ceder Exp $ * Copyright (C) 1991 Lysator Academic Computer Association. * * This file is part of the LysKOM server. @@ -31,7 +31,7 @@ * It has grown! /ceder */ -static char *rcsid = "$Id: ramkomd.c,v 0.28 1992/04/15 22:59:23 ceder Exp $"; +static char *rcsid = "$Id: ramkomd.c,v 0.29 1992/05/25 21:13:31 ceder Exp $"; #include <m-config.h> @@ -95,8 +95,11 @@ INTERNAL char memusefile[BUFSIZ]; /* Memory usage file. */ static char ip_client_port[80]; /* Port to listen to for clients */ static char ip_mux_port[80]; /* Port to listen to for mux:es */ -IscSession *listen_client = NULL; /* ISC listen identifier */ -IscSession *listen_mux = NULL; /* -"- */ +int num_ip_client_port=0; /* Numeric representation of the above. */ +int num_ip_mux_port=0; /* -"- */ + +static IscSession *listen_client = NULL; /* ISC listen identifier */ +static IscSession *listen_mux = NULL; /* -"- */ static char *dbase_dir = NULL; /* Directory where database resides */ @@ -108,6 +111,7 @@ static void server_init( char * client_port, char * mux_port) { IscConfig config; + IscAddress *isc_adr = NULL; /* ** Setup some parameters here @@ -117,15 +121,15 @@ server_init( char * client_port, char * mux_port) config.master.memfn.alloc = &isc_malloc_wrapper; config.master.memfn.realloc = &isc_realloc_wrapper; config.master.memfn.free = &isc_free_wrapper; - config.master.abortfn = NULL; /* FIXME+++ */ + config.master.abortfn = NULL; /* Use default abort function. */ config.session.version = 1001; - config.session.max.msgsize = -1; + config.session.max.msgsize = -1; /* Use default sizes. */ config.session.max.queuedsize = -1; config.session.max.dequeuelen = -1; config.session.max.openretries = -1; config.session.max.backlog = -1; - kom_server_mcb = isc_initialize(NULL); + kom_server_mcb = isc_initialize(&config); if ( kom_server_mcb == NULL ) restart_kom("server_init: can't isc_initialize()\n"); @@ -133,10 +137,26 @@ server_init( char * client_port, char * mux_port) if (listen_client == NULL) restart_kom("server_init: can't isc_listentcp(CLIENT)\n"); - listen_mux = isc_listentcp(kom_server_mcb, NULL, mux_port); + isc_adr = isc_getladdress (listen_client); + if (isc_adr == NULL) + restart_kom("server_init(): can't isc_getladdress (listen_client)\n"); + + num_ip_client_port = isc_getportnum (isc_adr); + isc_freeaddress (isc_adr); + + listen_mux = isc_listentcp (kom_server_mcb, NULL, mux_port); if (listen_mux == NULL) restart_kom("server_init: can't isc_listentcp(MUX)\n"); + + isc_adr = isc_getladdress (listen_mux); + if (isc_adr == NULL) + restart_kom("server_init(): can't isc_getladdress (listen_mux)\n"); + num_ip_mux_port = isc_getportnum (isc_adr); + isc_freeaddress (isc_adr); + + log("Listening for clients on %d and muxes on %d.\n", + num_ip_client_port, num_ip_mux_port); /* * Ignore SIGPIPE, which the server gets if it tries to write to a