X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fdatabase.c;h=8ab626e6835b5d70d65a3a176ad4312864c64ad7;hb=55d2a488196632a7c297795a173e85d5cbf7989a;hp=6f1599a8f404fdd1d53ae5e9a662b797d58c5fef;hpb=ebf24e785974c368809d73394a24eb80506598fd;p=pazpar2-moved-to-github.git diff --git a/src/database.c b/src/database.c index 6f1599a..8ab626e 100644 --- a/src/database.c +++ b/src/database.c @@ -27,9 +27,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#include -#include "pazpar2.h" +#include "session.h" #include "host.h" +#include "pazpar2_config.h" #include "settings.h" #include "http.h" #include "zeerex.h" @@ -108,6 +110,7 @@ static struct host *create_host(const char *hostport, iochan_man_t iochan_man) return 0; } yaz_mutex_create(&host->mutex); + yaz_mutex_set_name(host->mutex, "host"); return host; } @@ -409,9 +412,29 @@ database_hosts_t database_hosts_create(void) p->hosts = 0; p->mutex = 0; yaz_mutex_create(&p->mutex); + yaz_mutex_set_name(p->mutex, "database"); return p; } +void database_hosts_destroy(database_hosts_t *pp) +{ + if (*pp) + { + struct host *p = (*pp)->hosts; + while (p) + { + struct host *p_next = p->next; + yaz_mutex_destroy(&p->mutex); + xfree(p->ipport); + xfree(p->hostport); + xfree(p); + p = p_next; + } + yaz_mutex_destroy(&(*pp)->mutex); + xfree(*pp); + } +} + /* * Local variables: * c-basic-offset: 4