mp::ThreadPoolSocketObserver *m_thread_pool_observer,
const mp::Package *package,
std::string route,
- const char *msg_config);
+ Rep *rep);
int m_no_requests;
std::string m_route;
private:
mp::Origin m_origin;
bool m_delete_flag;
const mp::Package *m_package;
- const char *m_msg_config;
+ Rep *m_p;
};
class FrontendNet::ThreadPoolPackage : public mp::IThreadPoolMsg {
public:
ThreadPoolPackage(mp::Package *package,
yf::FrontendNet::ZAssocChild *ses,
- const char *msg_config);
+ Rep *rep);
~ThreadPoolPackage();
IThreadPoolMsg *handle();
void result(const char *t_info);
yaz_timing_t timer;
ZAssocChild *m_assoc_child;
mp::Package *m_package;
- const char *m_msg_config;
+ Rep *m_p;
};
class FrontendNet::ZAssocServer : public yazpp_1::Z_Assoc {
public:
~ZAssocServer();
- ZAssocServer(yazpp_1::IPDU_Observable *PDU_Observable, int timeout,
- int connect_max, std::string route,
- const char *msg_config);
+ ZAssocServer(yazpp_1::IPDU_Observable *PDU_Observable,
+ std::string route,
+ Rep *rep);
void set_package(const mp::Package *package);
- void set_thread_pool(ThreadPoolSocketObserver *m_thread_pool_observer);
+ void set_thread_pool(ThreadPoolSocketObserver *observer);
private:
yazpp_1::IPDU_Observer* sessionNotify(
yazpp_1::IPDU_Observable *the_PDU_Observable,
private:
mp::ThreadPoolSocketObserver *m_thread_pool_observer;
const mp::Package *m_package;
- int m_session_timeout;
- int m_connect_max;
yazpp_1::LimitConnect limit_connect;
std::string m_route;
- const char *m_msg_config;
+ Rep *m_p;
};
}
}
yf::FrontendNet::ThreadPoolPackage::ThreadPoolPackage(mp::Package *package,
ZAssocChild *ses,
- const char *msg_config) :
- m_assoc_child(ses), m_package(package), m_msg_config(msg_config)
+ Rep *rep) :
+ m_assoc_child(ses), m_package(package), m_p(rep)
{
- if (msg_config)
- timer = yaz_timing_create();
- else
- timer = 0;
+ timer = yaz_timing_create();
}
yf::FrontendNet::ThreadPoolPackage::~ThreadPoolPackage()
m_assoc_child->close();
}
- if (m_msg_config)
+ if (m_p->m_msg_config.length())
{
yaz_timing_stop(timer);
double duration = yaz_timing_get_real(timer);
Z_GDU *z_gdu = gdu->get();
std::ostringstream os;
- os << m_msg_config << " "
+ os << m_p->m_msg_config << " "
<< *m_package << " "
<< std::fixed << std::setprecision (6) << duration << " ";
return this;
}
-
yf::FrontendNet::ZAssocChild::ZAssocChild(
yazpp_1::IPDU_Observable *PDU_Observable,
mp::ThreadPoolSocketObserver *my_thread_pool,
const mp::Package *package,
- std::string route,
- const char *msg_config)
- : Z_Assoc(PDU_Observable), m_msg_config(msg_config)
+ std::string route, Rep *rep)
+ : Z_Assoc(PDU_Observable), m_p(rep)
{
m_thread_pool_observer = my_thread_pool;
m_no_requests = 0;
if (!peername)
peername = "unknown";
m_origin.set_tcpip_address(std::string(peername), m_session.id());
+ timeout(m_p->m_session_timeout);
}
-
yazpp_1::IPDU_Observer *yf::FrontendNet::ZAssocChild::sessionNotify(
- yazpp_1::IPDU_Observable
- *the_PDU_Observable, int fd)
+ yazpp_1::IPDU_Observable *the_PDU_Observable, int fd)
{
return 0;
}
mp::Package *p = new mp::Package(m_session, m_origin);
- ThreadPoolPackage *tp = new ThreadPoolPackage(p, this, m_msg_config);
+ ThreadPoolPackage *tp = new ThreadPoolPackage(p, this, m_p);
p->copy_route(*m_package);
p->request() = yazpp_1::GDU(z_pdu);
- if (m_msg_config)
+ if (m_p->m_msg_config.length())
{
if (z_pdu)
{
std::ostringstream os;
- os << m_msg_config << " "
+ os << m_p->m_msg_config << " "
<< *p << " "
<< "0.000000" << " "
<< *z_pdu;
mp::Package *p = new mp::Package(m_session, m_origin);
- ThreadPoolPackage *tp = new ThreadPoolPackage(p, this, m_msg_config);
+ ThreadPoolPackage *tp = new ThreadPoolPackage(p, this, m_p);
p->copy_route(*m_package);
m_thread_pool_observer->cleanup(tp, &m_session);
m_thread_pool_observer->put(tp);
yf::FrontendNet::ZAssocServer::ZAssocServer(
yazpp_1::IPDU_Observable *PDU_Observable,
- int timeout, int connect_max,
- std::string route, const char *msg_config)
+ std::string route,
+ Rep *rep)
:
- Z_Assoc(PDU_Observable), m_session_timeout(timeout),
- m_connect_max(connect_max), m_route(route), m_msg_config(msg_config)
+ Z_Assoc(PDU_Observable), m_route(route), m_p(rep)
{
m_package = 0;
}
m_package = package;
}
-void yf::FrontendNet::ZAssocServer::set_thread_pool(ThreadPoolSocketObserver *observer)
+void yf::FrontendNet::ZAssocServer::set_thread_pool(
+ ThreadPoolSocketObserver *observer)
{
m_thread_pool_observer = observer;
}
-yazpp_1::IPDU_Observer *yf::FrontendNet::ZAssocServer::sessionNotify(yazpp_1::IPDU_Observable
- *the_PDU_Observable, int fd)
+yazpp_1::IPDU_Observer *yf::FrontendNet::ZAssocServer::sessionNotify(
+ yazpp_1::IPDU_Observable *the_PDU_Observable, int fd)
{
const char *peername = the_PDU_Observable->getpeername();
limit_connect.add_connect(peername);
limit_connect.cleanup(false);
int con_sz = limit_connect.get_total(peername);
- if (m_connect_max && con_sz > m_connect_max)
+ if (m_p->m_connect_max && con_sz > m_p->m_connect_max)
return 0;
}
ZAssocChild *my = new ZAssocChild(the_PDU_Observable,
m_thread_pool_observer,
- m_package, m_route, m_msg_config);
- my->timeout(m_session_timeout);
+ m_package, m_route, m_p);
return my;
}
yazpp_1::PDU_Assoc *as = new yazpp_1::PDU_Assoc(&m_p->mySocketManager);
// create ZAssoc with PDU Assoc
- m_p->az[i] = new yf::FrontendNet::ZAssocServer(as,
- m_p->m_session_timeout,
- m_p->m_connect_max,
- m_p->m_ports[i].route,
- m_p->m_msg_config.length() > 0 ?
- m_p->m_msg_config.c_str() : 0);
+ m_p->az[i] = new yf::FrontendNet::ZAssocServer(
+ as, m_p->m_ports[i].route, m_p.get());
if (m_p->az[i]->server(m_p->m_ports[i].port.c_str()))
{
throw yf::FilterException("Unable to bind to address "