The problem was that a client was in Client_Idle case when it was actually
about to perform a search or other operation. The problem was in function
client_prep_connection where a client state was set to CLient_Idle if
connection was already open. This is wrong. The client is not idle: it
is about to perform a search. A new client state is therefore needed:
Client_Continue, which is like Client_Idle but differs in that a client
is considered active. Neither Connecting or Connected are the same stage
because these are states prior to Init Handshake with target.
<!ENTITY % idcommon SYSTEM "common/common.ent">
%idcommon;
]>
<!ENTITY % idcommon SYSTEM "common/common.ent">
%idcommon;
]>
-<!-- $Id: pazpar2_protocol.xml,v 1.14 2007-07-06 20:13:22 adam Exp $ -->
+<!-- $Id: pazpar2_protocol.xml,v 1.15 2007-09-20 08:13:26 adam Exp $ -->
<refentry id="pazpar2_protocol">
<refentryinfo>
<productname>Pazpar2</productname>
<refentry id="pazpar2_protocol">
<refentryinfo>
<productname>Pazpar2</productname>
The following client states are defined: Client_Connecting,
Client_Connected, Client_Idle, Client_Initializing, Client_Searching,
Client_Searching, Client_Presenting, Client_Error, Client_Failed,
The following client states are defined: Client_Connecting,
Client_Connected, Client_Idle, Client_Initializing, Client_Searching,
Client_Searching, Client_Presenting, Client_Error, Client_Failed,
- Client_Disconnected, Client_Stopped.
+ Client_Disconnected, Client_Stopped, Client_Continue.
-/* $Id: client.c,v 1.22 2007-09-19 13:23:35 adam Exp $
+/* $Id: client.c,v 1.23 2007-09-20 08:13:27 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
"Client_Error",
"Client_Failed",
"Client_Disconnected",
"Client_Error",
"Client_Failed",
"Client_Disconnected",
+ "Client_Stopped",
+ "Client_Continue"
};
static struct client *client_freelist = 0;
};
static struct client *client_freelist = 0;
if (cl->state == Client_Connected) {
client_init_request(cl);
}
if (cl->state == Client_Connected) {
client_init_request(cl);
}
- if (cl->state == Client_Idle)
+ if (cl->state == Client_Continue || cl->state == Client_Idle)
{
struct session *se = client_get_session(cl);
if (cl->requestid != se->requestid && cl->pquery) {
{
struct session *se = client_get_session(cl);
if (cl->requestid != se->requestid && cl->pquery) {
cl->records < cl->hits) {
client_send_present(cl);
}
cl->records < cl->hits) {
client_send_present(cl);
}
+ else
+ client_set_state(cl, Client_Idle);
int client_is_active(struct client *cl)
{
int client_is_active(struct client *cl)
{
- if (cl->connection && (cl->state == Client_Connecting ||
+ if (cl->connection && (cl->state == Client_Continue ||
+ cl->state == Client_Connecting ||
cl->state == Client_Initializing ||
cl->state == Client_Searching ||
cl->state == Client_Presenting))
cl->state == Client_Initializing ||
cl->state == Client_Searching ||
cl->state == Client_Presenting))
-/* $Id: client.h,v 1.3 2007-06-15 19:35:17 adam Exp $
+/* $Id: client.h,v 1.4 2007-09-20 08:13:27 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
Client_Error,
Client_Failed,
Client_Disconnected,
Client_Error,
Client_Failed,
Client_Disconnected,
+ Client_Stopped,
+ Client_Continue
};
int client_show_raw_begin(struct client *cl, int position,
};
int client_show_raw_begin(struct client *cl, int position,
-/* $Id: connection.c,v 1.11 2007-08-28 21:11:21 quinn Exp $
+/* $Id: connection.c,v 1.12 2007-09-20 08:13:27 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
else // we throw away response and go to idle mode
{
yaz_log(YLOG_DEBUG, "Ignoring result of expired operation");
else // we throw away response and go to idle mode
{
yaz_log(YLOG_DEBUG, "Ignoring result of expired operation");
- client_set_state(cl, Client_Idle);
+ client_set_state(cl, Client_Continue);
}
}
/* if len==1 we do nothing but wait for more input */
}
}
/* if len==1 we do nothing but wait for more input */
else if (co->state == Conn_Open)
{
if (client_get_state(cl) == Client_Error
else if (co->state == Conn_Open)
{
if (client_get_state(cl) == Client_Error
- || client_get_state(cl) == Client_Disconnected)
- client_set_state(cl, Client_Idle);
+ || client_get_state(cl) == Client_Disconnected
+ || client_get_state(cl) == Client_Idle)
+ client_set_state(cl, Client_Continue);
iochan_setflag(co->iochan, EVENT_OUTPUT);
}
return 1;
iochan_setflag(co->iochan, EVENT_OUTPUT);
}
return 1;