X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=server%2Fstatserv.c;h=6abbe443e3accb8b98cd925145a50940cbcc81c2;hb=3a14421799597d61196e2bb07bdd83396000cb45;hp=b514f291520588fb8f31142be114178f446a8145;hpb=8f7995bdfe85beb2ff6fa08e99bb05242f3bf71f;p=yaz-moved-to-github.git diff --git a/server/statserv.c b/server/statserv.c index b514f29..6abbe44 100644 --- a/server/statserv.c +++ b/server/statserv.c @@ -7,7 +7,16 @@ * Chas Woodfield, Fretwell Downing Datasystems. * * $Log: statserv.c,v $ - * Revision 1.47 1998-02-10 10:28:57 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 + * Changed code so that it compiles as C++. + * + * Revision 1.47 1998/02/10 10:28:57 adam * Added app_name, service_dependencies, service_display_name and * options_func. options_func allows us to specify a different function * to interogate the command line arguments. The other members allow us @@ -308,6 +317,7 @@ void statserv_remove(IOCHAN pIOChannel) { /* We need to look at another thread */ pNextThread = pCurrentThread->pNext; + pPrevThread = pCurrentThread; } } @@ -398,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) @@ -488,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); @@ -525,7 +548,7 @@ static void listener(IOCHAN h, int event) { if (pp != h) { - COMSTACK l = iochan_getdata(pp); + COMSTACK l = (COMSTACK)iochan_getdata(pp); cs_close(l); iochan_destroy(pp); } @@ -555,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) @@ -586,7 +609,7 @@ static void listener(IOCHAN h, int event) /* close our half of the listener socket */ for (pp = pListener; pp; pp = iochan_getnext(pp)) { - COMSTACK l = iochan_getdata(pp); + COMSTACK l = (COMSTACK)iochan_getdata(pp); cs_close(l); iochan_destroy(pp); }