summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/posix
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-12-08 02:18:03 +0000
committerAlan Conway <aconway@apache.org>2008-12-08 02:18:03 +0000
commitf739d191af76b1b22416f914212153db40abc17d (patch)
treec03e67763cbef3da63c39f3bb8013319da3d95df /cpp/src/qpid/sys/posix
parent35d88877f998b4419461b7cc88a7ffcf9a1adbd7 (diff)
downloadqpid-python-f739d191af76b1b22416f914212153db40abc17d.tar.gz
OutputControl and subclasses: added giveReadCredit() for IO level flow control.
Cluster: Set read credit limit for cluster connections. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@724233 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/posix')
-rw-r--r--cpp/src/qpid/sys/posix/AsynchIO.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/cpp/src/qpid/sys/posix/AsynchIO.cpp b/cpp/src/qpid/sys/posix/AsynchIO.cpp
index 50c971a181..9a5798311b 100644
--- a/cpp/src/qpid/sys/posix/AsynchIO.cpp
+++ b/cpp/src/qpid/sys/posix/AsynchIO.cpp
@@ -265,6 +265,7 @@ public:
virtual void notifyPendingWrite();
virtual void queueWriteClose();
virtual bool writeQueueEmpty();
+ virtual void startReading();
virtual BufferBase* getQueuedBuffer();
private:
@@ -381,6 +382,10 @@ bool AsynchIO::writeQueueEmpty() {
return writeQueue.empty();
}
+void AsynchIO::startReading() {
+ DispatchHandle::rewatchRead();
+}
+
/** Return a queued buffer if there are enough
* to spare
*/
@@ -418,7 +423,12 @@ void AsynchIO::readable(DispatchHandle& h) {
threadReadTotal += rc;
readTotal += rc;
- readCallback(*this, buff);
+ if (!readCallback(*this, buff)) {
+ // We were told to flow control reading at this point
+ h.unwatchRead();
+ break;
+ }
+
if (rc != readCount) {
// If we didn't fill the read buffer then time to stop reading
break;