summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2010-12-23 17:11:48 +0000
committerAndrew Stitcher <astitcher@apache.org>2010-12-23 17:11:48 +0000
commitff152807775cf3ad146742a59bbe44146cbb9a34 (patch)
tree19f87a8d23341e1d14ff5138d4f968867db174cd /cpp/src/qpid/client
parent0f8775149a61e04a9e514f28a2bd35766b3ca991 (diff)
downloadqpid-python-ff152807775cf3ad146742a59bbe44146cbb9a34.tar.gz
Changes due to review comments from Doug Ledford:
- Removed lock unsafe operation Rdma::QueuePair::bufferAvailable() and replaced the unavailable case with failing getBuffer(). - Improved asserts in the Rdma::QueuePair::getBuffer() code. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1052330 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client')
-rw-r--r--cpp/src/qpid/client/RdmaConnector.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/cpp/src/qpid/client/RdmaConnector.cpp b/cpp/src/qpid/client/RdmaConnector.cpp
index 313a99df68..e08ced0abc 100644
--- a/cpp/src/qpid/client/RdmaConnector.cpp
+++ b/cpp/src/qpid/client/RdmaConnector.cpp
@@ -349,14 +349,16 @@ void RdmaConnector::send(AMQFrame& frame) {
void RdmaConnector::writebuff(Rdma::AsynchIO&) {
// It's possible to be disconnected and be writable
Mutex::ScopedLock l(dataConnectedLock);
- if (!dataConnected)
+ if (!dataConnected) {
return;
-
+ }
Codec* codec = securityLayer.get() ? (Codec*) securityLayer.get() : (Codec*) this;
- if (codec->canEncode()) {
- Rdma::Buffer* buffer = aio->getBuffer();
+ if (!codec->canEncode()) {
+ return;
+ }
+ Rdma::Buffer* buffer = aio->getBuffer();
+ if (buffer) {
size_t encoded = codec->encode(buffer->bytes(), buffer->byteCount());
-
buffer->dataCount(encoded);
aio->queueWrite(buffer);
}
@@ -366,7 +368,7 @@ bool RdmaConnector::canEncode()
{
Mutex::ScopedLock l(lock);
//have at least one full frameset or a whole buffers worth of data
- return aio->writable() && aio->bufferAvailable() && (lastEof || currentSize >= maxFrameSize);
+ return aio->writable() && (lastEof || currentSize >= maxFrameSize);
}
size_t RdmaConnector::encode(const char* buffer, size_t size)