diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2010-12-23 17:11:48 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2010-12-23 17:11:48 +0000 |
| commit | ff152807775cf3ad146742a59bbe44146cbb9a34 (patch) | |
| tree | 19f87a8d23341e1d14ff5138d4f968867db174cd /cpp/src/qpid/sys/rdma/RdmaServer.cpp | |
| parent | 0f8775149a61e04a9e514f28a2bd35766b3ca991 (diff) | |
| download | qpid-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/sys/rdma/RdmaServer.cpp')
| -rw-r--r-- | cpp/src/qpid/sys/rdma/RdmaServer.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cpp/src/qpid/sys/rdma/RdmaServer.cpp b/cpp/src/qpid/sys/rdma/RdmaServer.cpp index d924c388ec..33bb8247a1 100644 --- a/cpp/src/qpid/sys/rdma/RdmaServer.cpp +++ b/cpp/src/qpid/sys/rdma/RdmaServer.cpp @@ -79,10 +79,11 @@ void dataError(Rdma::AsynchIO&) { void idle(ConRec* cr, Rdma::AsynchIO& a) { // Need to make sure full is not called as it would reorder messages - while (!cr->queuedWrites.empty() && a.writable() && a.bufferAvailable()) { + while (!cr->queuedWrites.empty() && a.writable()) { + Rdma::Buffer* rbuf = a.getBuffer(); + if (!rbuf) break; Buffer* buf = cr->queuedWrites.front(); cr->queuedWrites.pop(); - Rdma::Buffer* rbuf = a.getBuffer(); std::copy(buf->bytes(), buf->bytes()+buf->byteCount(), rbuf->bytes()); rbuf->dataCount(buf->byteCount()); delete buf; @@ -92,8 +93,11 @@ void idle(ConRec* cr, Rdma::AsynchIO& a) { void data(ConRec* cr, Rdma::AsynchIO& a, Rdma::Buffer* b) { // Echo data back - if (cr->queuedWrites.empty() && a.writable() && a.bufferAvailable()) { - Rdma::Buffer* buf = a.getBuffer(); + Rdma::Buffer* buf = 0; + if (cr->queuedWrites.empty() && a.writable()) { + buf = a.getBuffer(); + } + if (buf) { std::copy(b->bytes(), b->bytes()+b->dataCount(), buf->bytes()); buf->dataCount(b->dataCount()); a.queueWrite(buf); |
