From 087298c5eeb7746a1d0ded9067b1d582bd641a25 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 1 Dec 2000 17:59:08 +0000 Subject: [PATCH] Fixed bug regarding online updates on WIN32. When zebra.cfg is not available the server will not abort. --- index/locksrv.c | 9 ++++++--- index/zebraapi.c | 18 +++++++++++++++--- test/gils/zebra.cfg | 5 ++++- util/res.c | 12 +++++++++--- 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/index/locksrv.c b/index/locksrv.c index 10cf881..176aba5 100644 --- a/index/locksrv.c +++ b/index/locksrv.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: locksrv.c,v $ - * Revision 1.14 2000-03-15 15:00:30 adam + * Revision 1.15 2000-12-01 17:59:08 adam + * Fixed bug regarding online updates on WIN32. + * When zebra.cfg is not available the server will not abort. + * + * Revision 1.14 2000/03/15 15:00:30 adam * First work on threaded version. * * Revision 1.13 1999/05/26 07:49:13 adam @@ -71,7 +75,6 @@ int zebra_server_lock_init (ZebraService zi) { char path_prefix[1024]; - assert (zi->res); zi->server_lock_cmt = NULL; zi->server_lock_org = NULL; @@ -156,7 +159,7 @@ int zebra_server_lock_get_state (ZebraService zi, time_t *timep) if (stat (path, &xstat) == -1) *timep = 1; else - *timep = xstat.st_ctime; + *timep = xstat.st_mtime; strcpy (path, zi->server_path_prefix); strcat (path, FNAME_MAIN_LOCK); diff --git a/index/zebraapi.c b/index/zebraapi.c index 577b99a..a2c2d55 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -3,7 +3,11 @@ * All rights reserved. * * $Log: zebraapi.c,v $ - * Revision 1.40 2000-11-29 15:21:31 adam + * Revision 1.41 2000-12-01 17:59:08 adam + * Fixed bug regarding online updates on WIN32. + * When zebra.cfg is not available the server will not abort. + * + * Revision 1.40 2000/11/29 15:21:31 adam * Fixed problem with passwd db. * * Revision 1.39 2000/11/29 14:24:01 adam @@ -214,8 +218,12 @@ static int zebra_register_lock (ZebraHandle zh, int rw) logf (LOG_LOG, "Register in read/write mode"); else if (zh->service->registerState == state) { + logf (LOG_LOG, "registerChange = %ld lastChange = %ld", + (long) zh->service->registerChange, (long)lastChange); if (zh->service->registerChange >= lastChange) + { return 0; + } logf (LOG_LOG, "Register completely updated since last access"); } else if (zh->service->registerState == -1) @@ -297,7 +305,7 @@ ZebraService zebra_start (const char *configName) if (!(zh->res = res_open (zh->configName))) { logf (LOG_WARN, "Failed to read resources `%s'", zh->configName); - return zh; +// return zh; } zebra_chdir (zh); zebra_server_lock_init (zh); @@ -495,7 +503,11 @@ void zebra_stop(ZebraService zs) return ; yaz_log (LOG_LOG, "zebra_stop"); - assert (!zs->sessions); + zebra_mutex_cond_lock (&zs->session_lock); + while (zs->sessions) + zebra_close (zs->sessions); + + zebra_mutex_cond_unlock (&zs->session_lock); zebra_mutex_cond_destroy (&zs->session_lock); diff --git a/test/gils/zebra.cfg b/test/gils/zebra.cfg index ceee63b..09d35b3 100644 --- a/test/gils/zebra.cfg +++ b/test/gils/zebra.cfg @@ -1,5 +1,5 @@ # Simple Zebra configuration file -# $Id: zebra.cfg,v 1.10 1999-12-08 22:11:56 adam Exp $ +# $Id: zebra.cfg,v 1.11 2000-12-01 17:59:08 adam Exp $ # # Where the schema files, attribute files, etc are located. profilePath: .:../../tab:../../../yaz/tab @@ -11,3 +11,6 @@ attset: explain.att recordtype: grs.sgml +storekeys: 1 +storedata: 1 +#recordId: (bib1,identifier-standard) diff --git a/util/res.c b/util/res.c index 779db2d..d3307e7 100644 --- a/util/res.c +++ b/util/res.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: res.c,v $ - * Revision 1.27 1999-11-30 13:48:04 adam + * Revision 1.28 2000-12-01 17:59:08 adam + * Fixed bug regarding online updates on WIN32. + * When zebra.cfg is not available the server will not abort. + * + * Revision 1.27 1999/11/30 13:48:04 adam * Improved installation. Updated for inclusion of YAZ header files. * * Revision 1.26 1999/10/07 09:48:36 adam @@ -246,7 +250,8 @@ Res res_open (const char *name) void res_close (Res r) { - assert (r); + if (!r) + return; if (r->init) { struct res_entry *re, *re1; @@ -328,7 +333,8 @@ int res_trav (Res r, const char *prefix, void *p, int l = 0; int no = 0; - assert (r); + if (!r) + return 0; if (prefix) l = strlen(prefix); if (!r->init) -- 1.7.10.4