X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=server%2Fstatserv.c;h=6abbe443e3accb8b98cd925145a50940cbcc81c2;hp=2f9c86c92dce4b2fc30d1065cd69b0a7619227ac;hb=48096bb041fcc45b11666ad058963a633a0ec3db;hpb=6f2577984a4b90d7ef4c4565b619927cd45c9132 diff --git a/server/statserv.c b/server/statserv.c index 2f9c86c..6abbe44 100644 --- a/server/statserv.c +++ b/server/statserv.c @@ -7,7 +7,10 @@ * Chas Woodfield, Fretwell Downing Datasystems. * * $Log: statserv.c,v $ - * Revision 1.49 1998-02-27 14:04:55 adam + * Revision 1.50 1998-06-22 11:32:39 adam + * Added 'conditional cs_listen' feature. + * + * Revision 1.49 1998/02/27 14:04:55 adam * Fixed bug in statserv_remove. * * Revision 1.48 1998/02/11 11:53:36 adam @@ -405,7 +408,7 @@ static void listener(IOCHAN h, int event) { if ((res = cs_listen(line, 0, 0)) < 0) { - logf(LOG_FATAL, "cs_listen failed."); + logf(LOG_FATAL, "cs_listen failed"); return; } else if (res == 1) @@ -495,6 +498,19 @@ void statserv_closedown() iochan_destroy(p); } +static int check_ip(void *cd, const char *addr, int len, int type) +{ + const unsigned char *ip = (const unsigned char *) addr; + int i; + char str[64]; + + sprintf (str, "%u", *ip); + for (i = 1; i<4; i++) + sprintf (str + strlen(str), ".%u", ip[i]); + logf (LOG_DEBUG, "ip %s", str); + return 0; +} + static void listener(IOCHAN h, int event) { COMSTACK line = (COMSTACK) iochan_getdata(h); @@ -562,9 +578,9 @@ static void listener(IOCHAN h, int event) return; } } - if ((res = cs_listen(line, 0, 0)) < 0) + if ((res = cs_listen_check(line, 0, 0, check_ip, 0)) < 0) { - logf(LOG_FATAL, "cs_listen failed."); + logf(LOG_WARN, "cs_listen failed"); return; } else if (res == 1)