Commit b7e77c6a authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Fix the bug that made lyskom treat both muxes and clients as clients.

parent e4df2abf
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
......
/*
* $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 )
......
/*
* $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;
......
/*
* $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
......
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