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

Tell svn to ignore core files.

* src/server/testsuite: Ignore core and vgcore.*.

Replaced the "Client host" and "Client port" configuration file
parameters with "Listen", and allow lyskomd to listen to more than
one port.
* doc/lyskomd.texi (Parameters): Replaced "Client host" and
"Client port" with "Listen".
* src/server/ramkomd.c (start_listen_sockets): New static
function.  Listen to all the ports specified by the "Listen:"
parameter.
(server_init): Use start_listen_sockets() instead of calling
isc_listentcp().  Removed the host and client_port arguments.  All
callers updated.
* src/server/testsuite/lyskomd.0/54.exp: New test suite.
* src/server/conf-file.c (ctor_ipport_list): New static function.
(dtor_ipport_list): New static function.
(assign_ipport_list): New static function.
(cf_ipport_list): New constant.
* src/server/conf-file.h (struct ipport_entry): New struct.
(struct ipport_list): New struct.
(cf_ipport_list): New constant.
* src/server/param.h (struct kom_par): Replaced "ip_client_host"
and "ip_client_port" with "listen".
* src/server/server-config.c (parameters): Ditto.
* src/server/prot-a-parse-arg-c.awk: Include "conf-file.h" from
the generated files.
* src/server/admin.c: Include "conf-file.h".
* src/server/aux-items.c: Ditto.
* src/server/checkkomspace.c: Ditto.
* src/server/conference.c: Ditto.
* src/server/connections.c: Ditto.
* src/server/dbck-cache.c: Ditto.
* src/server/dbck.c: Ditto.
* src/server/disk-end-of-atomic.c: Ditto.
* src/server/komrunning.c: Ditto.
* src/server/lockdb.c: Ditto.
* src/server/membership.c: Ditto.
* src/server/person.c: Ditto.
* src/server/prot-a-output.c: Ditto.
* src/server/prot-a-parse.c: Ditto.
* src/server/prot-a.c: Ditto.
* src/server/regex-match.c: Ditto.
* src/server/rfc931.c: Ditto.
* src/server/send-async.c: Ditto.
* src/server/session.c: Ditto.
* src/server/simple-cache.c: Ditto.
* src/server/splitkomdb.c: Ditto.
* src/server/text-garb.c: Ditto.
* src/server/text.c: Ditto.
* src/server/updateLysKOM.c: Ditto.
* run-support/config: Removed the "Client port" setting.

Adjust the test suite for the above change.
* src/server/testsuite/lyskomd.0/bug-64.exp: Expect memory leaks
due to bug 1599.
* src/server/testsuite/lyskomd.0/53.exp: Expect a more informative
error message when isc_listentcp fails.
* src/server/testsuite/lyskomd.0/11.exp: Expect an IP address in
the "Listening for clients" log message.
* src/server/testsuite/config/unix.exp (clientport_2): New
constant.
(clientport_3): New constant.
(lyskomd_start): New argument: listen_messages.  Use "Listen:"
instead of "Client port:".
(lyskomd_fail_start): Use "Listen:" instead of "Client port:".
(client_start): New optional argument: port.
parent 4c6723a9
......@@ -38,8 +38,7 @@ struct kom_par
Bool garb_enable;
Bool never_save;
char *logaccess_file;
char *ip_client_host; /* IP to listen to (default: INADDR_ANY) */
char *ip_client_port; /* Port to listen to for clients */
struct ipport_list listen;
Bool use_dns;
double dns_log_threshold;
Conf_no conf_pres_conf;
......
......@@ -69,6 +69,7 @@
#include "log.h"
#include "minmax.h"
#include "lyskomd.h"
#include "conf-file.h"
#include "param.h"
#include "aux-items.h"
#include "local-to-global.h"
......
......@@ -53,6 +53,7 @@
#include "connections.h"
#include "prot-a-output.h"
#include "lyskomd.h"
#include "conf-file.h"
#include "param.h"
#include "local-to-global.h"
......
......@@ -49,6 +49,7 @@ BEGIN {
printf("#include \"prot-a-parse.h\"\n");
printf("#include \"prot-a-parse-arg.h\"\n");
printf("#include \"kom-config.h\"\n");
printf("#include \"conf-file.h\"\n\n");
printf("#include \"param.h\"\n\n");
}
$1 == "#ifdef" {
......
......@@ -59,6 +59,7 @@
#include "isc-interface.h"
#include "log.h"
#include "minmax.h"
#include "conf-file.h"
#include "param.h"
#include "kom-memory.h"
......
......@@ -58,6 +58,7 @@
#include "prot-a-output.h"
#include "prot-a-parse.h"
#include "isc-parse.h"
#include "conf-file.h"
#include "param.h"
#include "kom-memory.h"
......
......@@ -68,6 +68,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <assert.h>
#include "oop.h"
......@@ -137,6 +138,9 @@ static oop_call_signal sighandler_quit;
static oop_call_signal sighandler_usr1;
static oop_call_signal sighandler_usr2;
static oop_call_signal sighandler_winch;
/* handle_accept_event is declared in connections.h. We redeclare it
once more here, just to make sure that its signature matches the
isc_accept_callback typedef. */
isc_accept_callback handle_accept_event;
......@@ -167,9 +171,34 @@ write_queue_change_callback(int delta)
static void
server_init(const char *host, const char * client_port)
start_listen_sockets(void)
{
struct isc_scb *listen_client;
int i;
for (i = 0; i < param.listen.size; ++i)
{
struct ipport_entry *port = &param.listen.entries[i];
listen_client = isc_listentcp(kom_server_mcb,
port->ipaddr,
port->port,
handle_accept_event);
if (listen_client == NULL)
restart_kom("server_init: can't isc_listentcp(%s, %s)\n",
port->ipaddr ? port->ipaddr : "*", port->port);
assert(listen_client->laddr != NULL);
kom_log("Listening for clients on %s:%d.\n",
isc_getipnum(listen_client->laddr, NULL, 0),
isc_getportnum(listen_client->laddr));
}
}
static void
server_init(void)
{
oop_source *src;
#ifdef HAVE_STRUCT_SIGACTION
struct sigaction act;
......@@ -243,14 +272,8 @@ server_init(const char *host, const char * client_port)
param.maxqueuedsize,
param.maxdequeuelen);
listen_client = isc_listentcp(kom_server_mcb, host, client_port,
handle_accept_event);
if (listen_client == NULL)
restart_kom("server_init: can't isc_listentcp(CLIENT)\n");
kom_log("Listening for clients on %d.\n",
isc_getportnum(listen_client->laddr));
start_listen_sockets();
/*
* Ignore SIGPIPE, which the server gets if it tries to write to a
* socket and the client has died. The server will anyhow handle
......@@ -266,6 +289,7 @@ server_init(const char *host, const char * client_port)
#endif
}
static void
init_data_base(void)
{
......@@ -554,7 +578,7 @@ initialize(const char *config_file)
exit(1);
}
server_init(param.ip_client_host, param.ip_client_port);
server_init();
init_data_base();
}
......
......@@ -57,6 +57,7 @@
#include "manipulate.h"
#include "log.h"
#include "kom-config.h"
#include "conf-file.h"
#include "param.h"
static Success
......
......@@ -52,6 +52,7 @@
#include "isc-interface.h"
#include "misc-types.h"
#include "kom-types.h"
#include "conf-file.h"
#include "param.h"
#include "rfc931.h"
#include "unused.h"
......
......@@ -50,6 +50,7 @@
#include "prot-a-send-async.h"
#include "lyskomd.h"
#include "log.h"
#include "conf-file.h"
#include "param.h"
#include "ldifftime.h"
#include "kom-errno.h"
......
......@@ -56,8 +56,8 @@
#include "misc-types.h"
#include "s-string.h"
#include "kom-types.h"
#include "param.h"
#include "conf-file.h"
#include "param.h"
#include "admin.h"
#include "log.h"
#include "lyskomd.h"
......@@ -113,12 +113,9 @@ static const struct parameter parameters[] = {
&cf_bool, 0, 1, "1",
&param.send_async_messages,
NULL},
{"Client host",
&cf_string, 0, 1, NULL, &param.ip_client_host,
NULL},
{"Client port",
&cf_string, 1, 1, NULL, &param.ip_client_port,
NULL},
{"Listen",
&cf_ipport_list, 0, -1, "4894", &param.listen,
"4894"},
{"Presentation of conferences",
&cf_conf_no, 0, 1, "1", &kom_info.conf_pres_conf,
NULL},
......
......@@ -56,6 +56,7 @@
#include "send-async.h"
#include "kom-config.h"
#include "server/smalloc.h"
#include "conf-file.h"
#include "param.h"
#include "kom-memory.h"
#include "string-malloc.h"
......
......@@ -81,6 +81,7 @@
#include "async.h"
#include "connections.h"
#include "send-async.h"
#include "conf-file.h"
#include "param.h"
#include "kom-config.h"
#include "admin.h"
......
......@@ -44,6 +44,7 @@
#include "server/smalloc.h"
#include "kom-config.h"
#include "server-config.h"
#include "conf-file.h"
#include "param.h"
#include "linkansi.h"
#include "eintr.h"
......
......@@ -77,6 +77,12 @@ set any_float "\[0-9\]\[-0-9e.+\]*"
# The port that is used for Protocol A connections by the test suite.
set clientport 53262
# Port 53263 is used by ../locksuite.py.
# Extra ports used for Protocol A connections in some tests.
set clientport_2 53264
set clientport_3 53265
set aux_item_default_conf_file "$top_srcdir/run-support/aux-items.conf"
# Fix the tty settings for minimum impact on the data flow.
......@@ -590,7 +596,8 @@ proc lyskomd_start {{aux_item_conf_file ""} \
{texts 1} \
{nogarb 0} \
{db_messages {}} \
{pre_lock_messages {}}} {
{pre_lock_messages {}} \
{listen_messages {}}} {
global spawn_id
global server_id
......@@ -630,7 +637,7 @@ proc lyskomd_start {{aux_item_conf_file ""} \
}
set cf [open "config/lyskomd-config" "w"]
puts $cf "Client port: $clientport"
puts $cf "Listen: $clientport"
puts $cf "Prefix: [pwd]"
# FIXME (bug 1088): For now, we continue to use the pre-2.1.0 file names.
......@@ -751,7 +758,10 @@ proc lyskomd_start {{aux_item_conf_file ""} \
}
unset test
simple_expect "Listening for clients on $clientport."
simple_expect "Listening for clients on 0.0.0.0:$clientport."
foreach listenmsg $listen_messages {
simple_expect "$listenmsg"
}
simple_expect "Database = [pwd]/db/lyskomd-data"
simple_expect "Backup = [pwd]/db/lyskomd-backup"
simple_expect "2nd Backup = [pwd]/db/lyskomd-backup-prev"
......@@ -825,7 +835,7 @@ proc lyskomd_fail_start {log_messages
system "chmod 644 db/lyskomd-data db/lyskomd-texts db/number.txt"
set cf [open "config/lyskomd-config" "w"]
puts $cf "Client port: $clientport"
puts $cf "Listen: $clientport"
if { $base_config == "" } {
puts $cf "Max conferences: 2000"
puts $cf "Max texts: 2000"
......@@ -1224,7 +1234,7 @@ proc dbck_run {{extra_lines {}}} {
check_valgrind valgrind-dbck.log 0 1 {}
}
proc client_start {nr} {
proc client_start {nr {port 0}} {
global client_id
global clientport
global spawn_id
......@@ -1236,7 +1246,11 @@ proc client_start {nr} {
global deep_any
global python
spawn $python $srcdir/tcpconnect.py localhost $clientport MRK:client$nr
if {$port == 0} {
set port $clientport
}
spawn $python $srcdir/tcpconnect.py localhost $port MRK:client$nr
set client_id($nr) $spawn_id
set expect_active($client_id($nr)) " -i $client_id($nr) -re \"($deep_any*)$nl\" { fail \"\$test (unexpected line \$expect_out(1,string))\"; exp_continue } timeout { fail \"\$test (timeout on client $nr)\" }"
set expect_always($client_id($nr)) \
......@@ -1244,7 +1258,7 @@ proc client_start {nr} {
talk_to client $nr
simple_expect "Connecting to localhost $clientport" \
simple_expect "Connecting to localhost $port" \
"client connects" meta
simple_expect "Connected" "client connected" meta
}
......
......@@ -172,7 +172,7 @@ expect {
full_buffer {fail "$test (full_buffer)"}
eof {fail "$test (eof)"; wait}
}
simple_expect "Listening for clients on $clientport."
simple_expect "Listening for clients on 0.0.0.0:$clientport."
simple_expect "Database = [pwd]/db/lyskomd-data"
simple_expect "Backup = [pwd]/db/lyskomd-backup"
simple_expect "2nd Backup = [pwd]/db/lyskomd-backup-prev"
......
......@@ -28,8 +28,8 @@ simple_expect "socket bound"
lyskomd_fail_start \
[list "Created lock [pwd]/db/lyskomd-lock" \
"server_init: can't isc_listentcp\\(CLIENT\\)" \
] "" "" "" "" {} {"Bug 1599" 0 157 1 2}
"server_init: can't isc_listentcp\\(\\*, $clientport\\)" \
] "" "" "" "" {} {"Bug 1599" 0 158 1 2}
talk_to utility 1
......
# Test suite for lyskomd.
# Copyright (C) 2006 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
#
# LysKOM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
#
# LysKOM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with LysKOM; see the file COPYING. If not, write to
# Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
# or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
# MA 02139, USA.
#
# Please report bugs at http://bugzilla.lysator.liu.se/.
# Test the "Listen" configuration directive.
lyskomd_start "" "Listen: 127.0.0.1:$clientport_2
Listen: $clientport_3" "" "" "" {} 1 0 6 1 0 {} {} [list \
"Listening for clients on 127.0.0.1:$clientport_2." \
"Listening for clients on 0.0.0.0:$clientport_3."
]
client_start 0
client_start 1 $clientport_2
client_start 2 $clientport_3
talk_to client 1
send "A3Hfoo\n"
simple_expect "LysKOM"
send "1000 0 5 6Hgazonk\n"
simple_expect ":2 9 5 2"
simple_expect "=1000"
send "1001 42 255\n"
simple_expect "=1001"
talk_to client 0
send "A0H\n"
simple_expect "LysKOM"
talk_to client 2
send "A1Hx\n"
simple_expect "LysKOM"
talk_to client 1
send "1002 44 0\n"
simple_expect "=1002"
client_death 0
client_death 1
client_death 2
lyskomd_death
# This test assumes that "localhost" resolves to 127.0.0.1. I hope it is
# uncommon with systems where that assumption doesn't hold.
lyskomd_start "" "Listen: localhost:$clientport_2
Listen: $clientport_3" "" "" "" {} 1 0 6 1 0 {} {} [list \
"Listening for clients on 127.0.0.1:$clientport_2." \
"Listening for clients on 0.0.0.0:$clientport_3."
]
client_start 0
client_start 1 $clientport_2
client_start 2 $clientport_3
talk_to client 1
send "A3Hfoo\n"
simple_expect "LysKOM"
send "1003 0 5 6Hgazonk\n"
simple_expect ":2 9 5 2"
simple_expect "=1003"
send "1004 42 255\n"
simple_expect "=1004"
talk_to client 0
send "A0H\n"
simple_expect "LysKOM"
talk_to client 2
send "A1Hx\n"
simple_expect "LysKOM"
talk_to client 1
send "1005 44 0\n"
simple_expect "=1005"
client_death 0
client_death 1
client_death 2
lyskomd_death
......@@ -51,11 +51,11 @@ lyskomd_fail_start \
"<<<[pwd]/lyskomd.0/bug-64-2.aux: 19: undefined function: gazonk" \
"<<<[pwd]/lyskomd.0/bug-64-2.aux: 24: invalid type: expected identifier or string, got boolean" \
"Errors reading aux-item definition file" \
] "lyskomd.0/bug-64-2.aux"
] "lyskomd.0/bug-64-2.aux" "" "" "" {} {"Bug 1599" 0 31 0 2}
# Test the fatal error message when no aux-item definition file exists.
lyskomd_fail_start \
[list \
"<<<[pwd]/lyskomd.0/nosuchfile.aux: No such file or directory" \
"Unable to open aux-item definition file" \
] "lyskomd.0/nosuchfile.aux"
] "lyskomd.0/nosuchfile.aux" "" "" "" {} {"Bug 1599" 0 25 0 0}
......@@ -53,6 +53,7 @@
#include "cache.h"
#include "lyskomd.h"
#include "log.h"
#include "conf-file.h"
#include "param.h"
#include "server-time.h"
#include "com.h"
......
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