summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/AsynchIOHandler.cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2012-10-24 05:51:38 +0000
committerAndrew Stitcher <astitcher@apache.org>2012-10-24 05:51:38 +0000
commit46ac396386fee5e816e5d3a9fae2355017e079bb (patch)
treec86c0f0d9d5693b92e09292f03bcdd0823c57068 /cpp/src/qpid/sys/AsynchIOHandler.cpp
parent5d1d8481c376435051d5b24171dbb209c779b9ab (diff)
downloadqpid-python-46ac396386fee5e816e5d3a9fae2355017e079bb.tar.gz
QPID-4272: Large amounts of code are duplicated between the SSL and TCP transports
Add the security related functions to the Socket/Asynch interfaces git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1401560 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/AsynchIOHandler.cpp')
-rw-r--r--cpp/src/qpid/sys/AsynchIOHandler.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/cpp/src/qpid/sys/AsynchIOHandler.cpp b/cpp/src/qpid/sys/AsynchIOHandler.cpp
index e766a0527a..99e745c698 100644
--- a/cpp/src/qpid/sys/AsynchIOHandler.cpp
+++ b/cpp/src/qpid/sys/AsynchIOHandler.cpp
@@ -51,7 +51,7 @@ struct ProtocolTimeoutTask : public sys::TimerTask {
}
};
-AsynchIOHandler::AsynchIOHandler(const std::string& id, ConnectionCodec::Factory* f) :
+AsynchIOHandler::AsynchIOHandler(const std::string& id, ConnectionCodec::Factory* f, bool nodict0) :
identifier(id),
aio(0),
factory(f),
@@ -59,6 +59,7 @@ AsynchIOHandler::AsynchIOHandler(const std::string& id, ConnectionCodec::Factory
reads(0),
readError(false),
isClient(false),
+ nodict(nodict0),
readCredit(InfiniteCredit)
{}
@@ -118,6 +119,15 @@ void AsynchIOHandler::giveReadCredit(int32_t credit) {
aio->startReading();
}
+namespace {
+ SecuritySettings getSecuritySettings(AsynchIO* aio, bool nodict)
+ {
+ SecuritySettings settings = aio->getSecuritySettings();
+ settings.nodict = nodict;
+ return settings;
+ }
+}
+
void AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) {
if (readError) {
return;
@@ -168,7 +178,7 @@ void AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) {
QPID_LOG(debug, "RECV [" << identifier << "]: INIT(" << protocolInit << ")");
try {
- codec = factory->create(protocolInit.getVersion(), *this, identifier, SecuritySettings());
+ codec = factory->create(protocolInit.getVersion(), *this, identifier, getSecuritySettings(aio, nodict));
if (!codec) {
//TODO: may still want to revise this...
//send valid version header & close connection.
@@ -226,7 +236,7 @@ void AsynchIOHandler::nobuffs(AsynchIO&) {
void AsynchIOHandler::idle(AsynchIO&){
if (isClient && codec == 0) {
- codec = factory->create(*this, identifier, SecuritySettings());
+ codec = factory->create(*this, identifier, getSecuritySettings(aio, nodict));
write(framing::ProtocolInitiation(codec->getVersion()));
// We've just sent the protocol negotiation so we can cancel the timeout for that
// This is not ideal, because we've not received anything yet, but heartbeats will