From 457c6599b5dae1fb9e06b1c1a2f58a0922de5851 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 28 Mar 2011 11:15:49 +0200 Subject: [PATCH] Both option -X and -R enables predictable sessions We need predictable sessions when pazpar2 saves HTTP requests. If not replay will refer to invalid sessions. --- src/http_command.c | 2 +- src/parameters.h | 1 + src/pazpar2.c | 2 ++ src/session.c | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/http_command.c b/src/http_command.c index 6acc2c3..b3e4dc7 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -269,7 +269,7 @@ unsigned int make_sessionid(void) unsigned int res; seq++; - if (global_parameters.debug_mode) + if (global_parameters.predictable_sessions) res = seq; else { diff --git a/src/parameters.h b/src/parameters.h index 59a1222..3b45497 100644 --- a/src/parameters.h +++ b/src/parameters.h @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA struct parameters { int dump_records; int debug_mode; + int predictable_sessions; }; extern struct parameters global_parameters; diff --git a/src/pazpar2.c b/src/pazpar2.c index 84a3253..fcbbca2 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -139,6 +139,7 @@ static int sc_main( break; case 'R': record_fname = arg; + global_parameters.predictable_sessions = 1; break; case 't': test_mode = 1; @@ -153,6 +154,7 @@ static int sc_main( show_version(); case 'X': global_parameters.debug_mode++; + global_parameters.predictable_sessions = 1; break; default: fprintf(stderr, "Usage: pazpar2\n" diff --git a/src/session.c b/src/session.c index 194ab36..c0006a5 100644 --- a/src/session.c +++ b/src/session.c @@ -86,7 +86,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA struct parameters global_parameters = { 0, // dump_records - 0 // debug_mode + 0, // debug_mode + 0, // predictable sessions }; struct client_list { -- 1.7.10.4