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
ingest_record: lock client, then session
[pazpar2-moved-to-github.git]
/
src
/
session.c
diff --git
a/src/session.c
b/src/session.c
index
4653238
..
309d9ff
100644
(file)
--- a/
src/session.c
+++ b/
src/session.c
@@
-25,6
+25,7
@@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <config.h>
#endif
#include <config.h>
#endif
+#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@
-359,7
+360,7
@@
static int prepare_map(struct session *se, struct session_database *sdb)
}
}
sdb->map = normalize_cache_get(se->normalize_cache,
}
}
sdb->map = normalize_cache_get(se->normalize_cache,
- se->service, s);
+ se->service->server->config, s);
if (!sdb->map)
return -1;
}
if (!sdb->map)
return -1;
}
@@
-513,6
+514,8
@@
enum pazpar2_error_code search(struct session *se,
int no_working = 0;
int no_failed = 0;
struct client_list *l;
int no_working = 0;
int no_failed = 0;
struct client_list *l;
+ struct timespec abstime;
+ struct timeval tval;
yaz_log(YLOG_DEBUG, "Search");
yaz_log(YLOG_DEBUG, "Search");
@@
-535,6
+538,11
@@
enum pazpar2_error_code search(struct session *se,
}
se->reclist = reclist_create(se->nmem);
}
se->reclist = reclist_create(se->nmem);
+ gettimeofday(&tval, 0);
+
+ abstime.tv_sec = tval.tv_sec + 5;
+ abstime.tv_nsec = tval.tv_usec * 1000;
+
for (l = se->clients; l; l = l->next)
{
struct client *cl = l->client;
for (l = se->clients; l; l = l->next)
{
struct client *cl = l->client;
@@
-552,7
+560,8
@@
enum pazpar2_error_code search(struct session *se,
no_working++;
if (client_prep_connection(cl, se->service->z3950_operation_timeout,
se->service->z3950_session_timeout,
no_working++;
if (client_prep_connection(cl, se->service->z3950_operation_timeout,
se->service->z3950_session_timeout,
- se->service->server->iochan_man))
+ se->service->server->iochan_man,
+ &abstime))
client_start_search(cl);
}
}
client_start_search(cl);
}
}
@@
-1163,14
+1172,10
@@
int ingest_record(struct client *cl, const char *rec,
xmlFreeDoc(xdoc);
return -1;
}
xmlFreeDoc(xdoc);
return -1;
}
- client_unlock(cl);
session_enter(se);
session_enter(se);
- client_lock(cl);
if (client_get_session(cl) == se)
ret = ingest_to_cluster(cl, xdoc, root, record_no, mergekey_norm);
if (client_get_session(cl) == se)
ret = ingest_to_cluster(cl, xdoc, root, record_no, mergekey_norm);
- client_unlock(cl);
session_leave(se);
session_leave(se);
- client_lock(cl);
xmlFreeDoc(xdoc);
return ret;
xmlFreeDoc(xdoc);
return ret;