projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed bug #722: Allow Z39.50 Init Options to be specified / retrieved. Client code...
[yaz-moved-to-github.git]
/
src
/
zoom-c.c
diff --git
a/src/zoom-c.c
b/src/zoom-c.c
index
4f346ee
..
65d14ab
100644
(file)
--- a/
src/zoom-c.c
+++ b/
src/zoom-c.c
@@
-2,7
+2,7
@@
* Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
* Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: zoom-c.c,v 1.97 2006-11-06 23:21:30 adam Exp $
+ * $Id: zoom-c.c,v 1.101 2006-12-06 11:12:14 mike Exp $
*/
/**
* \file zoom-c.c
*/
/**
* \file zoom-c.c
@@
-453,9
+453,6
@@
ZOOM_API(void)
else
c->lang = 0;
else
c->lang = 0;
- val = ZOOM_options_get(c->options, "sru");
- c->sru_mode = get_sru_mode_from_string(val);
-
xfree(c->host_port);
if (portnum)
{
xfree(c->host_port);
if (portnum)
{
@@
-497,6
+494,9
@@
ZOOM_API(void)
}
}
}
}
+ val = ZOOM_options_get(c->options, "sru");
+ c->sru_mode = get_sru_mode_from_string(val);
+
ZOOM_options_set(c->options, "host", c->host_port);
val = ZOOM_options_get(c->options, "cookie");
ZOOM_options_set(c->options, "host", c->host_port);
val = ZOOM_options_get(c->options, "cookie");
@@
-1276,7
+1276,7
@@
static zoom_ret ZOOM_connection_send_init(ZOOM_connection c)
odr_prepend(c->odr_out, "ZOOM-C",
ireq->implementationName));
odr_prepend(c->odr_out, "ZOOM-C",
ireq->implementationName));
- version = odr_strdup(c->odr_out, "$Revision: 1.97 $");
+ version = odr_strdup(c->odr_out, "$Revision: 1.101 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
ireq->implementationVersion =
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
ireq->implementationVersion =
@@
-3306,8
+3306,6
@@
static int ZOOM_connection_exec_task(ZOOM_connection c)
c, task->which, task->running);
if (c->error != ZOOM_ERROR_NONE)
{
c, task->which, task->running);
if (c->error != ZOOM_ERROR_NONE)
{
- yaz_log(YLOG_LOG, "%p ZOOM_connection_exec_task "
- "removing tasks because of error = %d", c, c->error);
yaz_log(log_details, "%p ZOOM_connection_exec_task "
"removing tasks because of error = %d", c, c->error);
ZOOM_connection_remove_tasks(c);
yaz_log(log_details, "%p ZOOM_connection_exec_task "
"removing tasks because of error = %d", c, c->error);
ZOOM_connection_remove_tasks(c);
@@
-3438,6
+3436,16
@@
static void interpret_otherinformation_field(ZOOM_connection c,
}
}
}
}
+
+static void set_init_option(const char *name, void *clientData) {
+ ZOOM_connection c = clientData;
+ char buf[80];
+
+ sprintf(buf, "init_opt_%.70s", name);
+ ZOOM_connection_option_set(c, buf, "1");
+}
+
+
static void recv_apdu(ZOOM_connection c, Z_APDU *apdu)
{
Z_InitResponse *initrs;
static void recv_apdu(ZOOM_connection c, Z_APDU *apdu)
{
Z_InitResponse *initrs;
@@
-3468,6
+3476,10
@@
static void recv_apdu(ZOOM_connection c, Z_APDU *apdu)
ZOOM_connection_option_set(c, "targetImplementationVersion",
initrs->implementationVersion ?
initrs->implementationVersion : "");
ZOOM_connection_option_set(c, "targetImplementationVersion",
initrs->implementationVersion ?
initrs->implementationVersion : "");
+
+ /* Make initrs->options available as ZOOM-level options */
+ yaz_init_opt_decode(initrs->options, set_init_option, (void*) c);
+
if (!*initrs->result)
{
Z_External *uif = initrs->userInformationField;
if (!*initrs->result)
{
Z_External *uif = initrs->userInformationField;
@@
-4189,7
+4201,7
@@
ZOOM_API(int)
;
}
if (r < 0)
;
}
if (r < 0)
- yaz_log(YLOG_WARN|YLOG_ERRNO, "ZOOM_event: poll failed");
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "ZOOM_event: poll");
for (i = 0; i<nfds; i++)
{
ZOOM_connection c = poll_cs[i];
for (i = 0; i<nfds; i++)
{
ZOOM_connection c = poll_cs[i];
@@
-4217,6
+4229,15
@@
ZOOM_API(int)
#else
tv.tv_sec = timeout;
tv.tv_usec = 0;
#else
tv.tv_sec = timeout;
tv.tv_usec = 0;
+
+ while ((r = select(max_fd+1, &input, &output, &except,
+ (timeout == -1 ? 0 : &tv))) < 0 && errno == EINTR)
+ {
+ ;
+ }
+ if (r < 0)
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "ZOOM_event: select");
+
r = select(max_fd+1, &input, &output, &except, (timeout == -1 ? 0 : &tv));
for (i = 0; i<no; i++)
{
r = select(max_fd+1, &input, &output, &except, (timeout == -1 ? 0 : &tv));
for (i = 0; i<no; i++)
{