projects
/
metaproxy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
multi: relays user info for first rejected target
[metaproxy-moved-to-github.git]
/
src
/
filter_frontend_net.cpp
diff --git
a/src/filter_frontend_net.cpp
b/src/filter_frontend_net.cpp
index
216d740
..
e94998c
100644
(file)
--- a/
src/filter_frontend_net.cpp
+++ b/
src/filter_frontend_net.cpp
@@
-32,6
+32,7
@@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <yazpp/limit-connect.h>
#include <yaz/timing.h>
#include <yaz/log.h>
#include <yazpp/limit-connect.h>
#include <yaz/timing.h>
#include <yaz/log.h>
+#include "gduutil.hpp"
#include <iostream>
#include <iostream>
@@
-103,7
+104,7
@@
namespace metaproxy_1 {
~ThreadPoolPackage();
IThreadPoolMsg *handle();
void result(const char *t_info);
~ThreadPoolPackage();
IThreadPoolMsg *handle();
void result(const char *t_info);
-
+ bool cleanup(void *info);
private:
yaz_timing_t timer;
mp::ZAssocChild *m_assoc_child;
private:
yaz_timing_t timer;
mp::ZAssocChild *m_assoc_child;
@@
-126,7
+127,7
@@
namespace metaproxy_1 {
void failNotify();
void timeoutNotify();
void failNotify();
void timeoutNotify();
- void connectNotify();
+ void connectNotify();
private:
mp::ThreadPoolSocketObserver *m_thread_pool_observer;
const mp::Package *m_package;
private:
mp::ThreadPoolSocketObserver *m_thread_pool_observer;
const mp::Package *m_package;
@@
-155,6
+156,13
@@
mp::ThreadPoolPackage::~ThreadPoolPackage()
delete m_package;
}
delete m_package;
}
+bool mp::ThreadPoolPackage::cleanup(void *info)
+{
+ mp::Session *ses = (mp::Session *) info;
+
+ return *ses == m_package->session();
+}
+
void mp::ThreadPoolPackage::result(const char *t_info)
{
m_assoc_child->m_no_requests--;
void mp::ThreadPoolPackage::result(const char *t_info)
{
m_assoc_child->m_no_requests--;
@@
-205,11
+213,17
@@
void mp::ThreadPoolPackage::result(const char *t_info)
{
yaz_timing_stop(timer);
double duration = yaz_timing_get_real(timer);
{
yaz_timing_stop(timer);
double duration = yaz_timing_get_real(timer);
+ Z_GDU *z_gdu = gdu->get();
std::ostringstream os;
os << m_msg_config << " "
<< *m_package << " "
std::ostringstream os;
os << m_msg_config << " "
<< *m_package << " "
- << std::fixed << std::setprecision (6) << duration;
+ << std::fixed << std::setprecision (6) << duration << " ";
+
+ if (z_gdu)
+ os << *z_gdu;
+ else
+ os << "-";
yaz_log(YLOG_LOG, "%s %s", os.str().c_str(), t_info);
}
yaz_log(YLOG_LOG, "%s %s", os.str().c_str(), t_info);
}
@@
-263,6
+277,19
@@
void mp::ZAssocChild::recv_GDU(Z_GDU *z_pdu, int len)
m_msg_config);
p->copy_route(*m_package);
p->request() = yazpp_1::GDU(z_pdu);
m_msg_config);
p->copy_route(*m_package);
p->request() = yazpp_1::GDU(z_pdu);
+
+ if (m_msg_config)
+ {
+ if (z_pdu)
+ {
+ std::ostringstream os;
+ os << m_msg_config << " "
+ << *p << " "
+ << "0.000000" << " "
+ << *z_pdu;
+ yaz_log(YLOG_LOG, "%s", os.str().c_str());
+ }
+ }
m_thread_pool_observer->put(tp);
}
m_thread_pool_observer->put(tp);
}
@@
-284,7
+311,8
@@
void mp::ZAssocChild::failNotify()
mp::ThreadPoolPackage *tp = new mp::ThreadPoolPackage(p, this,
m_msg_config);
p->copy_route(*m_package);
mp::ThreadPoolPackage *tp = new mp::ThreadPoolPackage(p, this,
m_msg_config);
p->copy_route(*m_package);
- m_thread_pool_observer->put(tp);
+ m_thread_pool_observer->cleanup(tp, &m_session);
+ m_thread_pool_observer->put(tp);
}
void mp::ZAssocChild::timeoutNotify()
}
void mp::ZAssocChild::timeoutNotify()
@@
-428,6
+456,9
@@
void mp::filter::FrontendNet::process(Package &package) const
}
while (m_p->mySocketManager.processEvent() > 0)
{
}
while (m_p->mySocketManager.processEvent() > 0)
{
+ int no = m_p->mySocketManager.getNumberOfObservers();
+ if (no <= 1)
+ break;
if (tt && tt->timeout())
break;
}
if (tt && tt->timeout())
break;
}