At this point (-X) only affects the session ID creation.
-/* $Id: http_command.c,v 1.43 2007-05-23 09:57:54 adam Exp $
+/* $Id: http_command.c,v 1.44 2007-05-23 21:58:28 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
*/
/*
- * $Id: http_command.c,v 1.43 2007-05-23 09:57:54 adam Exp $
+ * $Id: http_command.c,v 1.44 2007-05-23 21:58:28 adam Exp $
*/
#include <stdio.h>
unsigned int make_sessionid()
{
static int seq = 0;
-#if 1
- return ++seq;
-#else
- struct timeval t;
unsigned int res;
seq++;
- if (gettimeofday(&t, 0) < 0)
- abort();
- res = t.tv_sec;
- res = ((res << 8) | (seq & 0xff)) & ((1U << 31) - 1);
+ if (global_parameters.debug_mode)
+ res = seq;
+ else
+ {
+ struct timeval t;
+
+ if (gettimeofday(&t, 0) < 0)
+ {
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "gettimeofday");
+ exit(1);
+ }
+ /* at most 256 sessions per second ..
+ (long long would be more appropriate)*/
+ res = t.tv_sec;
+ res = ((res << 8) | (seq & 0xff)) & ((1U << 31) - 1);
+ }
return res;
-#endif
}
static struct http_session *locate_session(struct http_request *rq, struct http_response *rs)
-/* $Id: logic.c,v 1.31 2007-05-23 14:44:18 marc Exp $
+/* $Id: logic.c,v 1.32 2007-05-23 21:58:28 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
"",
"",
0,
- 0,
+ 0, /* dump_records */
+ 0, /* debug_mode */
30,
"81",
"Index Data PazPar2",
-/* $Id: parameters.h,v 1.1 2007-04-23 21:05:23 adam Exp $
+/* $Id: parameters.h,v 1.2 2007-05-23 21:58:28 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
char settings_path_override[128];
struct conf_server *server;
int dump_records;
+ int debug_mode;
int timeout; /* operations timeout, in seconds */
char implementationId[128];
char implementationName[128];
-/* $Id: pazpar2.c,v 1.84 2007-05-15 21:27:55 adam Exp $
+/* $Id: pazpar2.c,v 1.85 2007-05-23 21:58:28 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
yaz_log_init_prefix("pazpar2");
- while ((ret = options("f:h:p:z:t:l:d", argv, argc, &arg)) != -2)
+ while ((ret = options("f:h:p:z:t:l:dX", argv, argc, &arg)) != -2)
{
switch (ret)
{
case 'l':
yaz_log_init_file(arg);
break;
+ case 'X':
+ global_parameters.debug_mode = 1;
+ break;
default:
fprintf(stderr, "Usage: pazpar2\n"
" -f configfile\n"
" -t settings\n"
" -d (show internal records)\n"
" -l file log to file\n"
+ " -X debug mode\n"
);
exit(1);
}
#!/bin/sh
-# $Id: test_http.sh,v 1.6 2007-05-16 13:07:18 adam Exp $
+# $Id: test_http.sh,v 1.7 2007-05-23 21:58:29 adam Exp $
#
# Regression test using pazpar2 against z3950.indexdata.com/marc
# Reads Pazpar2 URLs from test_http_urls
# Fire up pazpar2
rm -f pazpar2.log
-../src/pazpar2 -l pazpar2.log -f ${srcdir}/test_http.cfg -t ${srcdir}/test_http.xml >extra_pazpar2.log 2>&1 &
+../src/pazpar2 -X -l pazpar2.log -f ${srcdir}/test_http.cfg -t ${srcdir}/test_http.xml >extra_pazpar2.log 2>&1 &
PP2PID=$!
# Give it a chance to start properly..
else
sleep $f
fi
+ if ps -p $PP2PID >/dev/null 2>&1; then
+ :
+ else
+ echo "pazpar2 died"
+ fi
done
IFS="$oIFS"