summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/SslPlugin.cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2013-05-02 14:59:32 +0000
committerAndrew Stitcher <astitcher@apache.org>2013-05-02 14:59:32 +0000
commit4fd1498babadec27548a06e4266e0bdf7abf5ac1 (patch)
tree680f987c83cc2447366b6ef043f3cdf397adbea9 /cpp/src/qpid/sys/SslPlugin.cpp
parent5fee347ebfc01770cc5bc071bab605522220202b (diff)
downloadqpid-python-4fd1498babadec27548a06e4266e0bdf7abf5ac1.tar.gz
QPID-4807: Add new broker option to disable listening on specific transport type
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1478398 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/SslPlugin.cpp')
-rw-r--r--cpp/src/qpid/sys/SslPlugin.cpp48
1 files changed, 23 insertions, 25 deletions
diff --git a/cpp/src/qpid/sys/SslPlugin.cpp b/cpp/src/qpid/sys/SslPlugin.cpp
index 20ca9256fc..b99b93137a 100644
--- a/cpp/src/qpid/sys/SslPlugin.cpp
+++ b/cpp/src/qpid/sys/SslPlugin.cpp
@@ -43,12 +43,10 @@ struct SslServerOptions : ssl::SslOptions
uint16_t port;
bool clientAuth;
bool nodict;
- bool multiplex;
SslServerOptions() : port(5671),
clientAuth(false),
- nodict(false),
- multiplex(false)
+ nodict(false)
{
addOptions()
("ssl-port", optValue(port, "PORT"), "Port on which to listen for SSL connections")
@@ -78,10 +76,11 @@ namespace {
static struct SslPlugin : public Plugin {
SslServerOptions options;
bool nssInitialized;
+ bool multiplex;
Options* getOptions() { return &options; }
- SslPlugin() : nssInitialized(false) {}
+ SslPlugin() : nssInitialized(false), multiplex(false) {}
~SslPlugin() { if (nssInitialized) ssl::shutdownNSS(); }
void earlyInitialize(Target& target) {
@@ -90,14 +89,11 @@ static struct SslPlugin : public Plugin {
broker::Broker::Options& opts = broker->getOptions();
if (opts.port == options.port && // AMQP & AMQPS ports are the same
- opts.port != 0) {
- // The presence of this option is used to signal to the TCP
- // plugin not to start listening on the shared port. The actual
- // value cannot be configured through the command line or config
- // file (other than by setting the ports to the same value)
- // because we are only adding it after option parsing.
- options.multiplex = true;
- options.addOptions()("ssl-multiplex", optValue(options.multiplex), "Allow SSL and non-SSL connections on the same port");
+ opts.port != 0 &&
+ broker->shouldListen("tcp")&&
+ broker->shouldListen("ssl")) {
+ multiplex = true;
+ broker->disableListening("tcp");
}
}
}
@@ -115,21 +111,23 @@ static struct SslPlugin : public Plugin {
nssInitialized = true;
const broker::Broker::Options& opts = broker->getOptions();
+ uint16_t port = options.port;
TransportAcceptor::shared_ptr ta;
- SocketAcceptor* sa =
- new SocketAcceptor(opts.tcpNoDelay, options.nodict, opts.maxNegotiateTime, broker->getTimer());
- uint16_t port = sa->listen(opts.listenInterfaces, boost::lexical_cast<std::string>(options.port), opts.connectionBacklog,
- options.multiplex ?
- boost::bind(&createServerSSLMuxSocket, options) :
- boost::bind(&createServerSSLSocket, options));
- if ( port!=0 ) {
- ta.reset(sa);
- QPID_LOG(notice, "Listening for " <<
- (options.multiplex ? "SSL or TCP" : "SSL") <<
- " connections on TCP/TCP6 port " <<
- port);
+ if (broker->shouldListen("ssl")) {
+ SocketAcceptor* sa =
+ new SocketAcceptor(opts.tcpNoDelay, options.nodict, opts.maxNegotiateTime, broker->getTimer());
+ port = sa->listen(opts.listenInterfaces, boost::lexical_cast<std::string>(options.port), opts.connectionBacklog,
+ multiplex ?
+ boost::bind(&createServerSSLMuxSocket, options) :
+ boost::bind(&createServerSSLSocket, options));
+ if ( port!=0 ) {
+ ta.reset(sa);
+ QPID_LOG(notice, "Listening for " <<
+ (multiplex ? "SSL or TCP" : "SSL") <<
+ " connections on TCP/TCP6 port " <<
+ port);
+ }
}
-
TransportConnector::shared_ptr tc(
new SocketConnector(opts.tcpNoDelay, options.nodict, opts.maxNegotiateTime, broker->getTimer(),
&createClientSSLSocket));