summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/TCPIOPlugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/sys/TCPIOPlugin.cpp')
-rw-r--r--cpp/src/qpid/sys/TCPIOPlugin.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/cpp/src/qpid/sys/TCPIOPlugin.cpp b/cpp/src/qpid/sys/TCPIOPlugin.cpp
index 9d272ee69c..e82a6a9102 100644
--- a/cpp/src/qpid/sys/TCPIOPlugin.cpp
+++ b/cpp/src/qpid/sys/TCPIOPlugin.cpp
@@ -53,20 +53,22 @@ class AsynchIOProtocolFactory : public ProtocolFactory {
bool isClient);
};
-struct TCPIOPlugin : public PluginT<broker::Broker> {
- void initializeT(broker::Broker& broker) {
- const broker::Broker::Options& opts = broker.getOptions();
- ProtocolFactory::shared_ptr protocol(new AsynchIOProtocolFactory(opts.port, opts.connectionBacklog));
- QPID_LOG(info, "Listening on TCP port " << protocol->getPort());
- broker.registerProtocolFactory(protocol);
+// Static instance to initialise plugin
+static class TCPIOPlugin : public Plugin {
+ void earlyInitialize(Target&) {
}
-};
-
-static struct TCPIOPluginFactory : public Plugin::FactoryT<broker::Broker> {
- boost::shared_ptr<Plugin> createT(broker::Broker&) {
- return make_shared_ptr(new TCPIOPlugin());
+
+ void initialize(Target& target) {
+ broker::Broker* broker = dynamic_cast<broker::Broker*>(&target);
+ // Only provide to a Broker
+ if (broker) {
+ const broker::Broker::Options& opts = broker->getOptions();
+ ProtocolFactory::shared_ptr protocol(new AsynchIOProtocolFactory(opts.port, opts.connectionBacklog));
+ QPID_LOG(info, "Listening on TCP port " << protocol->getPort());
+ broker->registerProtocolFactory(protocol);
+ }
}
-} theTCPIOPluginFactory; // Static plugin factory instance.
+} tcpPlugin;
AsynchIOProtocolFactory::AsynchIOProtocolFactory(int16_t port, int backlog) :
listeningPort(listener.listen(port, backlog))