struct session *session;
char *pquery; // Current search
char *cqlquery; // used for SRU targets only
+ char *addinfo; // diagnostic info for most resent error
Odr_int hits;
int record_offset;
int maxrecs;
cl->startrecs = 0;
cl->pquery = 0;
cl->cqlquery = 0;
+ cl->addinfo = 0;
cl->database = 0;
cl->connection = 0;
cl->session = 0;
c->pquery = 0;
xfree(c->cqlquery);
c->cqlquery = 0;
+ xfree(c->addinfo);
+ c->addinfo = 0;
xfree(c->id);
assert(!c->connection);
facet_limits_destroy(c->facet_limits);
return cl->record_offset;
}
-void client_set_diagnostic(struct client *cl, int diagnostic)
+void client_set_diagnostic(struct client *cl, int diagnostic,
+ const char *addinfo)
{
cl->diagnostic = diagnostic;
+ xfree(cl->addinfo);
+ cl->addinfo = 0;
+ if (addinfo)
+ cl->addinfo = xstrdup(addinfo);
}
-int client_get_diagnostic(struct client *cl)
+int client_get_diagnostic(struct client *cl, const char **addinfo)
{
+ if (addinfo)
+ *addinfo = cl->addinfo;
return cl->diagnostic;
}
const char *maxrecs);
Odr_int client_get_hits(struct client *cl);
int client_get_num_records(struct client *cl);
-int client_get_diagnostic(struct client *cl);
-void client_set_diagnostic(struct client *cl, int diagnostic);
+int client_get_diagnostic(struct client *cl, const char **addinfo);
+void client_set_diagnostic(struct client *cl, int diagnostic,
+ const char *addinfo);
void client_set_database(struct client *cl, struct session_database *db);
const char *client_get_id(struct client *cl);
int client_get_maxrecs(struct client *cl);
{
yaz_log(YLOG_LOG, "Error %s from %s",
error, client_get_id(cl));
- client_set_diagnostic(cl, err);
+ client_set_diagnostic(cl, err, addinfo);
client_set_state(cl, Client_Error);
}
else
{
yaz_log(YLOG_LOG, "Error %s from %s",
error, client_get_id(co->client));
- client_set_diagnostic(co->client, err);
+ client_set_diagnostic(co->client, err, addinfo);
client_set_state_nb(co->client, Client_Error);
}
}
wrbuf_printf(c->wrbuf, "<hits>" ODR_INT_PRINTF "</hits>\n", ht[i].hits);
wrbuf_printf(c->wrbuf, "<diagnostic>%d</diagnostic>\n", ht[i].diagnostic);
+ if (ht[i].diagnostic)
+ {
+ wrbuf_puts(c->wrbuf, "<addinfo>");
+ if (ht[i].addinfo)
+ wrbuf_xmlputs(c->wrbuf, ht[i].addinfo);
+ wrbuf_puts(c->wrbuf, "</addinfo>\n");
+ }
+
wrbuf_printf(c->wrbuf, "<records>%d</records>\n", ht[i].records);
wrbuf_puts(c->wrbuf, "<state>");
res[*count].name = *name ? name : "Unknown";
res[*count].hits = client_get_hits(cl);
res[*count].records = client_get_num_records(cl);
- res[*count].diagnostic = client_get_diagnostic(cl);
+ res[*count].diagnostic =
+ client_get_diagnostic(cl, &res[*count].addinfo);
res[*count].state = client_get_state_str(cl);
res[*count].connected = client_get_connection(cl) ? 1 : 0;
session_settings_dump(se, client_get_database(cl), w);
const char *name;
Odr_int hits;
int diagnostic;
+ const char *addinfo;
int records;
const char *state;
int connected;