X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ffilter_frontend_net.cpp;h=93319b799a70adb5f0ce0c0b44f47c328f71e5f6;hb=8ced8e7b5de3ecba12ac68ce5c5e8cddf40d800f;hp=4743c27ef4b5333c61b6f820e2156a93cfaf3c8b;hpb=b8e963ed4f4accb1a3c0bf06f0da35cf698a69c3;p=metaproxy-moved-to-github.git diff --git a/src/filter_frontend_net.cpp b/src/filter_frontend_net.cpp index 4743c27..93319b7 100644 --- a/src/filter_frontend_net.cpp +++ b/src/filter_frontend_net.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2012 Index Data + Copyright (C) 2005-2013 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 @@ -47,6 +47,7 @@ namespace metaproxy_1 { friend class FrontendNet; std::string port; std::string route; + int max_recv_bytes; }; class FrontendNet::Rep { friend class FrontendNet; @@ -442,7 +443,7 @@ void yf::FrontendNet::ZAssocServer::set_package(const mp::Package *package) } void yf::FrontendNet::ZAssocServer::set_thread_pool( - ThreadPoolSocketObserver *observer) + mp::ThreadPoolSocketObserver *observer) { m_thread_pool_observer = observer; } @@ -570,7 +571,7 @@ void yf::FrontendNet::My_Timer_Thread::socketNotify(int event) m_obs->deleteObserver(this); } -void yf::FrontendNet::process(Package &package) const +void yf::FrontendNet::process(mp::Package &package) const { if (m_p->az == 0) return; @@ -625,15 +626,21 @@ void yf::FrontendNet::configure(const xmlNode * ptr, bool test_only, if (!strcmp((const char *) ptr->name, "port")) { Port port; - const struct _xmlAttr *attr; - for (attr = ptr->properties; attr; attr = attr->next) - { - if (!strcmp((const char *) attr->name, "route")) - port.route = mp::xml::get_text(attr); - } - port.port = mp::xml::get_text(ptr); - ports.push_back(port); + const char *names[4] = {"route", "max_recv_bytes", "port", 0}; + std::string values[3]; + + mp::xml::parse_attr(ptr, names, values); + port.route = values[0]; + if (values[1].length() > 0) + port.max_recv_bytes = atoi(values[1].c_str()); + else + port.max_recv_bytes = 0; + if (values[2].length() > 0) + port.port = values[2]; + else + port.port = mp::xml::get_text(ptr); + ports.push_back(port); } else if (!strcmp((const char *) ptr->name, "threads")) { @@ -715,6 +722,11 @@ void yf::FrontendNet::set_ports(std::vector &ports) throw yf::FilterException("Unable to bind to address " + std::string(m_p->m_ports[i].port)); } + COMSTACK cs = as->get_comstack(); + + if (cs && m_p->m_ports[i].max_recv_bytes) + cs_set_max_recv_bytes(cs, m_p->m_ports[i].max_recv_bytes); + } }