diff options
Diffstat (limited to 'cpp')
| -rw-r--r-- | cpp/src/qpid/sys/ssl/SslHandler.cpp | 6 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/ssl/SslIo.cpp | 12 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/ssl/SslIo.h | 3 |
3 files changed, 19 insertions, 2 deletions
diff --git a/cpp/src/qpid/sys/ssl/SslHandler.cpp b/cpp/src/qpid/sys/ssl/SslHandler.cpp index 67bf4ea893..a512f8c1f8 100644 --- a/cpp/src/qpid/sys/ssl/SslHandler.cpp +++ b/cpp/src/qpid/sys/ssl/SslHandler.cpp @@ -80,8 +80,10 @@ void SslHandler::write(const framing::ProtocolInitiation& data) } void SslHandler::abort() { - // TODO: can't implement currently as underlying functionality not implemented - // aio->requestCallback(boost::bind(&SslHandler::eof, this, _1)); + // Don't disconnect if we're already disconnecting + if (!readError) { + aio->requestCallback(boost::bind(&SslHandler::eof, this, _1)); + } } void SslHandler::activateOutput() { aio->notifyPendingWrite(); diff --git a/cpp/src/qpid/sys/ssl/SslIo.cpp b/cpp/src/qpid/sys/ssl/SslIo.cpp index 2a7cf16923..789c205ead 100644 --- a/cpp/src/qpid/sys/ssl/SslIo.cpp +++ b/cpp/src/qpid/sys/ssl/SslIo.cpp @@ -257,6 +257,18 @@ void SslIO::queueWriteClose() { DispatchHandle::rewatchWrite(); } +void SslIO::requestCallback(RequestCallback callback) { + // TODO creating a function object every time isn't all that + // efficient - if this becomes heavily used do something better (what?) + assert(callback); + DispatchHandle::call(boost::bind(&SslIO::requestedCall, this, callback)); +} + +void SslIO::requestedCall(RequestCallback callback) { + assert(callback); + callback(*this); +} + /** Return a queued buffer if there are enough * to spare */ diff --git a/cpp/src/qpid/sys/ssl/SslIo.h b/cpp/src/qpid/sys/ssl/SslIo.h index c980d73831..b795594cd9 100644 --- a/cpp/src/qpid/sys/ssl/SslIo.h +++ b/cpp/src/qpid/sys/ssl/SslIo.h @@ -125,6 +125,7 @@ public: typedef boost::function2<void, SslIO&, const SslSocket&> ClosedCallback; typedef boost::function1<void, SslIO&> BuffersEmptyCallback; typedef boost::function1<void, SslIO&> IdleCallback; + typedef boost::function1<void, SslIO&> RequestCallback; private: @@ -159,6 +160,7 @@ public: void notifyPendingWrite(); void queueWriteClose(); bool writeQueueEmpty() { return writeQueue.empty(); } + void requestCallback(RequestCallback); BufferBase* getQueuedBuffer(); qpid::sys::SecuritySettings getSecuritySettings(); @@ -168,6 +170,7 @@ private: void readable(qpid::sys::DispatchHandle& handle); void writeable(qpid::sys::DispatchHandle& handle); void disconnected(qpid::sys::DispatchHandle& handle); + void requestedCall(RequestCallback); void close(qpid::sys::DispatchHandle& handle); }; |
