diff options
author | Andrew Stitcher <astitcher@apache.org> | 2009-09-22 15:59:53 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2009-09-22 15:59:53 +0000 |
commit | 3d3fb015b49b088a6e1f641437cd6b7acb0ed6ec (patch) | |
tree | 92337ec015253d12f5ad045922592d791ae3f1a3 /cpp/src | |
parent | 4551735283dd89c17529782305679a9ac744d31f (diff) | |
download | qpid-python-3d3fb015b49b088a6e1f641437cd6b7acb0ed6ec.tar.gz |
Make the AsynchIO API more consistent
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@817711 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/sys/AsynchIO.h | 2 | ||||
-rw-r--r-- | cpp/src/qpid/sys/AsynchIOHandler.cpp | 8 | ||||
-rw-r--r-- | cpp/src/qpid/sys/AsynchIOHandler.h | 2 | ||||
-rw-r--r-- | cpp/src/qpid/sys/posix/AsynchIO.cpp | 3 | ||||
-rw-r--r-- | cpp/src/qpid/sys/windows/AsynchIO.cpp | 2 |
5 files changed, 7 insertions, 10 deletions
diff --git a/cpp/src/qpid/sys/AsynchIO.h b/cpp/src/qpid/sys/AsynchIO.h index fb02183359..193d41aceb 100644 --- a/cpp/src/qpid/sys/AsynchIO.h +++ b/cpp/src/qpid/sys/AsynchIO.h @@ -108,7 +108,7 @@ class AsynchIO { public: typedef AsynchIOBufferBase BufferBase; - typedef boost::function2<bool, AsynchIO&, BufferBase*> ReadCallback; + typedef boost::function2<void, AsynchIO&, BufferBase*> ReadCallback; typedef boost::function1<void, AsynchIO&> EofCallback; typedef boost::function1<void, AsynchIO&> DisconnectCallback; typedef boost::function2<void, AsynchIO&, const Socket&> ClosedCallback; diff --git a/cpp/src/qpid/sys/AsynchIOHandler.cpp b/cpp/src/qpid/sys/AsynchIOHandler.cpp index 46d8f3b4f1..ae41eacfc3 100644 --- a/cpp/src/qpid/sys/AsynchIOHandler.cpp +++ b/cpp/src/qpid/sys/AsynchIOHandler.cpp @@ -103,13 +103,11 @@ void AsynchIOHandler::giveReadCredit(int32_t credit) { aio->startReading(); } -bool AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) { +void AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) { if (readError) { - return false; + return; } - bool ret = true; - // Check here for read credit if (readCredit.get() != InfiniteCredit) { // TODO In theory should be able to use an atomic operation before taking the lock @@ -119,7 +117,6 @@ bool AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) { assert(readCredit.get() >= 0); if (readCredit.get() == 0) { aio->stopReading(); - ret = false; } } } @@ -166,7 +163,6 @@ bool AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) { // Give whole buffer back to aio subsystem aio->queueReadBuffer(buff); } - return ret; } void AsynchIOHandler::eof(AsynchIO&) { diff --git a/cpp/src/qpid/sys/AsynchIOHandler.h b/cpp/src/qpid/sys/AsynchIOHandler.h index 9785f445a4..e1885bac79 100644 --- a/cpp/src/qpid/sys/AsynchIOHandler.h +++ b/cpp/src/qpid/sys/AsynchIOHandler.h @@ -65,7 +65,7 @@ class AsynchIOHandler : public OutputControl { QPID_COMMON_EXTERN void giveReadCredit(int32_t credit); // Input side - QPID_COMMON_EXTERN bool readbuff(AsynchIO& aio, AsynchIOBufferBase* buff); + QPID_COMMON_EXTERN void readbuff(AsynchIO& aio, AsynchIOBufferBase* buff); QPID_COMMON_EXTERN void eof(AsynchIO& aio); QPID_COMMON_EXTERN void disconnect(AsynchIO& aio); diff --git a/cpp/src/qpid/sys/posix/AsynchIO.cpp b/cpp/src/qpid/sys/posix/AsynchIO.cpp index 8545ebd9cb..c6d73b059e 100644 --- a/cpp/src/qpid/sys/posix/AsynchIO.cpp +++ b/cpp/src/qpid/sys/posix/AsynchIO.cpp @@ -467,7 +467,8 @@ void AsynchIO::readable(DispatchHandle& h) { threadReadTotal += rc; readTotal += rc; - if (!readCallback(*this, buff)) { + readCallback(*this, buff); + if (readingStopped) { // We have been flow controlled. break; } diff --git a/cpp/src/qpid/sys/windows/AsynchIO.cpp b/cpp/src/qpid/sys/windows/AsynchIO.cpp index 8905b87838..475b18600d 100644 --- a/cpp/src/qpid/sys/windows/AsynchIO.cpp +++ b/cpp/src/qpid/sys/windows/AsynchIO.cpp @@ -634,7 +634,7 @@ void AsynchIO::readComplete(AsynchReadResult *result) { if (status == 0 && bytes > 0) { bool restartRead = true; // May not if receiver doesn't want more if (readCallback) - restartRead = readCallback(*this, result->getBuff()); + readCallback(*this, result->getBuff()); if (restartRead) startReading(); } |