summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2008-04-22 21:13:20 +0000
committerAndrew Stitcher <astitcher@apache.org>2008-04-22 21:13:20 +0000
commit52ffbbfef04ee479a341ff640cb2df9c41897963 (patch)
treeb9cecb2bde45ad7b2c118d23e3d9c1f2c74560cf /cpp/src/qpid/broker
parent63d88fa5ff3407f26590bdf6b5a956d3307f677e (diff)
downloadqpid-python-52ffbbfef04ee479a341ff640cb2df9c41897963.tar.gz
* Renamed the Acceptor class to be the ProtocolFactory class
which better approximates its current behaviour * Slightly refactored TCPIOPlugin to better approximate how it would look when we implement a proper AsynchConnector git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@650657 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker')
-rw-r--r--cpp/src/qpid/broker/Broker.cpp36
-rw-r--r--cpp/src/qpid/broker/Broker.h14
2 files changed, 21 insertions, 29 deletions
diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp
index ec690a8acb..6cbd9bf343 100644
--- a/cpp/src/qpid/broker/Broker.cpp
+++ b/cpp/src/qpid/broker/Broker.cpp
@@ -35,7 +35,7 @@
#include "qpid/log/Statement.h"
#include "qpid/framing/AMQFrame.h"
#include "qpid/framing/ProtocolInitiation.h"
-#include "qpid/sys/Acceptor.h"
+#include "qpid/sys/ProtocolFactory.h"
#include "qpid/sys/Poller.h"
#include "qpid/sys/Dispatcher.h"
#include "qpid/sys/Thread.h"
@@ -54,7 +54,7 @@
#include <sasl/sasl.h>
#endif
-using qpid::sys::Acceptor;
+using qpid::sys::ProtocolFactory;
using qpid::sys::Poller;
using qpid::sys::Dispatcher;
using qpid::sys::Thread;
@@ -334,41 +334,33 @@ Manageable::status_t Broker::ManagementMethod (uint32_t methodId,
return status;
}
-boost::shared_ptr<Acceptor> Broker::getAcceptor() const {
- assert(acceptors.size() > 0);
-#if 0
- if (!acceptor) {
- const_cast<Acceptor::shared_ptr&>(acceptor) =
- Acceptor::create(config.port,
- config.connectionBacklog);
- QPID_LOG(info, "Listening on port " << getPort());
- }
-#endif
- return acceptors[0];
+boost::shared_ptr<ProtocolFactory> Broker::getProtocolFactory() const {
+ assert(protocolFactories.size() > 0);
+ return protocolFactories[0];
}
-void Broker::registerAccepter(Acceptor::shared_ptr acceptor) {
- acceptors.push_back(acceptor);
+void Broker::registerProtocolFactory(ProtocolFactory::shared_ptr protocolFactory) {
+ protocolFactories.push_back(protocolFactory);
}
-// TODO: This can only work if there is only one acceptor
+// TODO: This can only work if there is only one protocolFactory
uint16_t Broker::getPort() const {
- return getAcceptor()->getPort();
+ return getProtocolFactory()->getPort();
}
-// TODO: This should iterate over all acceptors
+// TODO: This should iterate over all protocolFactories
void Broker::accept() {
- for (unsigned int i = 0; i < acceptors.size(); ++i)
- acceptors[i]->run(poller, &factory);
+ for (unsigned int i = 0; i < protocolFactories.size(); ++i)
+ protocolFactories[i]->accept(poller, &factory);
}
-// TODO: How to chose the acceptor to use for the connection
+// TODO: How to chose the protocolFactory to use for the connection
void Broker::connect(
const std::string& host, uint16_t port,
sys::ConnectionCodec::Factory* f)
{
- getAcceptor()->connect(poller, host, port, f ? f : &factory);
+ getProtocolFactory()->connect(poller, host, port, f ? f : &factory);
}
void Broker::connect(
diff --git a/cpp/src/qpid/broker/Broker.h b/cpp/src/qpid/broker/Broker.h
index 02f34ff3ba..fa66061fd0 100644
--- a/cpp/src/qpid/broker/Broker.h
+++ b/cpp/src/qpid/broker/Broker.h
@@ -50,7 +50,7 @@
namespace qpid {
namespace sys {
- class Acceptor;
+ class ProtocolFactory;
class Poller;
}
@@ -124,8 +124,8 @@ class Broker : public sys::Runnable, public Plugin::Target,
management::Manageable::status_t
ManagementMethod (uint32_t methodId, management::Args& args);
- /** Add to the broker's acceptors */
- void registerAccepter(boost::shared_ptr<sys::Acceptor>);
+ /** Add to the broker's protocolFactorys */
+ void registerProtocolFactory(boost::shared_ptr<sys::ProtocolFactory>);
/** Accept connections */
void accept();
@@ -139,7 +139,7 @@ class Broker : public sys::Runnable, public Plugin::Target,
private:
boost::shared_ptr<sys::Poller> poller;
Options config;
- std::vector< boost::shared_ptr<sys::Acceptor> > acceptors;
+ std::vector< boost::shared_ptr<sys::ProtocolFactory> > protocolFactories;
MessageStore* store;
DataDir dataDir;
@@ -154,9 +154,9 @@ class Broker : public sys::Runnable, public Plugin::Target,
Vhost::shared_ptr vhostObject;
System::shared_ptr systemObject;
- // TODO: There is no longer a single acceptor so the use of the following needs to be fixed
- // For the present just return the first acceptor registered.
- boost::shared_ptr<sys::Acceptor> getAcceptor() const;
+ // TODO: There isn't a single ProtocolFactory so the use of the following needs to be fixed
+ // For the present just return the first ProtocolFactory registered.
+ boost::shared_ptr<sys::ProtocolFactory> getProtocolFactory() const;
void declareStandardExchange(const std::string& name, const std::string& type);
};