From 772484f911db95bbc0c1ac599ed72b2ee143bec0 Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Sat, 23 Jan 2010 00:16:34 +0000 Subject: Add SSL support for Windows client and broker per QPID-1403. Adds new AsynchIO::BufferBase::squish() method that does what used to be done by in-place memmove() calls so it can be reused easily. SSL support for Windows is in: - Client: qpid/client/windows/SslConnector.cpp qpid/client/TCPConnector.{h cpp} rearranged a bit to make pieces available to SslConnector - Broker: qpid/broker/windows/SslProtocolFactory.cpp - Common: qpid/sys/windows/SslAsynchIO contains all the Schannel stuff to negotiate a session, encrypt, and decrypt data. The SslAsynchIO acts as a shim between the layer above and the "regular" AsynchIO that actually handles read/write and completions. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@902318 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/TCPConnector.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'cpp/src/qpid/client/TCPConnector.cpp') diff --git a/cpp/src/qpid/client/TCPConnector.cpp b/cpp/src/qpid/client/TCPConnector.cpp index 00584d168e..94c4a4cae0 100644 --- a/cpp/src/qpid/client/TCPConnector.cpp +++ b/cpp/src/qpid/client/TCPConnector.cpp @@ -108,15 +108,23 @@ void TCPConnector::connected(const Socket&) { 0, // closed 0, // nobuffs boost::bind(&TCPConnector::writebuff, this, _1)); + start(aio); + initAmqp(); + aio->start(poller); +} + +void TCPConnector::start(sys::AsynchIO* aio_) { + aio = aio_; for (int i = 0; i < 32; i++) { aio->queueReadBuffer(new Buff(maxFrameSize)); } identifier = str(format("[%1% %2%]") % socket.getLocalPort() % socket.getPeerAddress()); +} + +void TCPConnector::initAmqp() { ProtocolInitiation init(version); writeDataBlock(init); - - aio->start(poller); } void TCPConnector::connectFailed(const std::string& msg) { @@ -286,7 +294,7 @@ size_t TCPConnector::decode(const char* buffer, size_t size) } void TCPConnector::writeDataBlock(const AMQDataBlock& data) { - AsynchIO::BufferBase* buff = new Buff(maxFrameSize); + AsynchIO::BufferBase* buff = aio->getQueuedBuffer(); framing::Buffer out(buff->bytes, buff->byteCount); data.encode(out); buff->dataCount = data.encodedSize(); -- cgit v1.2.1