/* This file is part of Metaproxy.
- Copyright (C) 2005-2009 Index Data
+ Copyright (C) 2005-2010 Index Data
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/format.hpp>
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "filter_session_shared.hpp"
#include <yaz/log.h>
m_named_result_sets = false;
Z_GDU *gdu = init_package.response().get();
- if (!init_package.session().is_closed()
- && gdu && gdu->which == Z_GDU_Z3950
- && gdu->u.z3950->which == Z_APDU_initResponse)
+ if (init_package.session().is_closed())
+ {
+ /* already closed. We don't know why */
+ return null;
+ }
+ else if (gdu && gdu->which == Z_GDU_Z3950
+ && gdu->u.z3950->which == Z_APDU_initResponse
+ && *gdu->u.z3950->u.initResponse->result)
{
+ /* successful init response */
Z_InitResponse *res = gdu->u.z3950->u.initResponse;
- if (!*res->result)
- return null;
m_init_response = gdu->u.z3950;
if (ODR_MASK_GET(res->options, Z_Options_namedResultSets))
{
}
else
{
- // did not receive an init response or closed
+ /* not init or init rejected */
+ init_package.copy_filter(frontend_package);
+ init_package.session().close();
+ init_package.move();
return null;
}
bp->m_in_use = true;
BackendClassPtr bc = m_backend_class;
{
boost::mutex::scoped_lock lock(bc->m_mutex_backend_class);
-
// look at each backend and see if we have a similar search
BackendInstanceList::const_iterator it = bc->m_backend_list.begin();