projects
/
pazpar2-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix session_nmem may be used by multiple threads PAZ-962
[pazpar2-moved-to-github.git]
/
src
/
http_command.c
diff --git
a/src/http_command.c
b/src/http_command.c
index
1de0354
..
309a617
100644
(file)
--- a/
src/http_command.c
+++ b/
src/http_command.c
@@
-1,5
+1,5
@@
/* This file is part of Pazpar2.
/* This file is part of Pazpar2.
- Copyright (C) 2006-2013 Index Data
+ Copyright (C) Index Data
Pazpar2 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
Pazpar2 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
@@
-401,6
+401,7
@@
static int process_settings(struct session *se, struct http_request *rq,
struct http_response *rs)
{
struct http_argument *a;
struct http_response *rs)
{
struct http_argument *a;
+ NMEM nmem = nmem_create();
for (a = rq->arguments; a; a = a->next)
if (strchr(a->name, '['))
for (a = rq->arguments; a; a = a->next)
if (strchr(a->name, '['))
@@
-411,17
+412,18
@@
static int process_settings(struct session *se, struct http_request *rq,
char *setting;
// Nmem_strsplit *rules*!!!
char *setting;
// Nmem_strsplit *rules*!!!
- nmem_strsplit(se->session_nmem, "[]", a->name, &res, &num);
+ nmem_strsplit(nmem, "[]", a->name, &res, &num);
if (num != 2)
{
error(rs, PAZPAR2_MALFORMED_SETTING, a->name);
if (num != 2)
{
error(rs, PAZPAR2_MALFORMED_SETTING, a->name);
+ nmem_destroy(nmem);
return -1;
}
setting = res[0];
dbname = res[1];
return -1;
}
setting = res[0];
dbname = res[1];
- session_apply_setting(se, dbname, setting,
- nmem_strdup(se->session_nmem, a->value));
+ session_apply_setting(se, dbname, setting, a->value);
}
}
+ nmem_destroy(nmem);
return 0;
}
return 0;
}
@@
-507,9
+509,7
@@
static void apply_local_setting(void *client_data,
{
struct session *se = (struct session *) client_data;
{
struct session *se = (struct session *) client_data;
- session_apply_setting(se, nmem_strdup(se->session_nmem, set->target),
- nmem_strdup(se->session_nmem, set->name),
- nmem_strdup(se->session_nmem, set->value));
+ session_apply_setting(se, set->target, set->name, set->value);
}
static void cmd_settings(struct http_channel *c)
}
static void cmd_settings(struct http_channel *c)
@@
-788,9
+788,9
@@
static void bytarget_response(struct http_channel *c, struct http_session *s,
wrbuf_printf(c->wrbuf, "<records>%d</records>\n",
ht[i].records - ht[i].filtered);
wrbuf_printf(c->wrbuf, "<records>%d</records>\n",
ht[i].records - ht[i].filtered);
+ wrbuf_printf(c->wrbuf, "<filtered>%d</filtered>\n", ht[i].filtered);
if (version >= 2)
{
if (version >= 2)
{
- wrbuf_printf(c->wrbuf, "<filtered>%d</filtered>\n", ht[i].filtered);
wrbuf_printf(c->wrbuf, "<approximation>" ODR_INT_PRINTF
"</approximation>\n", ht[i].approximation);
}
wrbuf_printf(c->wrbuf, "<approximation>" ODR_INT_PRINTF
"</approximation>\n", ht[i].approximation);
}
@@
-1288,7
+1288,7
@@
static void cmd_show(struct http_channel *c)
status = session_active_clients(s->psession);
status = session_active_clients(s->psession);
- if (block)
+ if (block && reclist_get_num_records(s->psession->reclist) == 0)
{
if (!strcmp(block, "preferred")
&& !session_is_preferred_clients_ready(s->psession)
{
if (!strcmp(block, "preferred")
&& !session_is_preferred_clients_ready(s->psession)