summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/posix/EventChannelConnection.cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2007-06-29 18:56:11 +0000
committerAndrew Stitcher <astitcher@apache.org>2007-06-29 18:56:11 +0000
commita258bbcaf007d20d943669b7ee6223016dd08d66 (patch)
tree0ea6092222386ebed2fb92c1d809d4eb7fa37557 /cpp/src/qpid/sys/posix/EventChannelConnection.cpp
parentf830f28dca100d70631af25e082000cf7aed540d (diff)
downloadqpid-python-a258bbcaf007d20d943669b7ee6223016dd08d66.tar.gz
* More work on asychronous network IO
* Fix of current EventQueue code to carry on compiling git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@552001 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/posix/EventChannelConnection.cpp')
-rw-r--r--cpp/src/qpid/sys/posix/EventChannelConnection.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/cpp/src/qpid/sys/posix/EventChannelConnection.cpp b/cpp/src/qpid/sys/posix/EventChannelConnection.cpp
index a36f096a4d..f4b6396dd1 100644
--- a/cpp/src/qpid/sys/posix/EventChannelConnection.cpp
+++ b/cpp/src/qpid/sys/posix/EventChannelConnection.cpp
@@ -62,11 +62,10 @@ EventChannelConnection::EventChannelConnection(
}
-void EventChannelConnection::send(std::auto_ptr<AMQFrame> frame) {
+void EventChannelConnection::send(AMQFrame& frame) {
{
Monitor::ScopedLock lock(monitor);
- assert(frame.get());
- writeFrames.push_back(frame.release());
+ writeFrames.push_back(frame);
}
closeOnException(&EventChannelConnection::startWrite);
}
@@ -119,7 +118,6 @@ void EventChannelConnection::closeOnException(MemberFnPtr f)
// Called by endWrite and send, but only one thread writes at a time.
//
void EventChannelConnection::startWrite() {
- FrameQueue::auto_type frame;
{
Monitor::ScopedLock lock(monitor);
// Stop if closed or a write event is already in progress.
@@ -130,14 +128,15 @@ void EventChannelConnection::startWrite() {
return;
}
isWriting = true;
- frame = writeFrames.pop_front();
+ AMQFrame& frame = writeFrames.front();
+ writeFrames.pop_front();
+ // No need to lock here - only one thread can be writing at a time.
+ out.clear();
+ if (isTrace)
+ cout << "Send on socket " << writeFd << ": " << frame << endl;
+ frame.encode(out);
+ out.flip();
}
- // No need to lock here - only one thread can be writing at a time.
- out.clear();
- if (isTrace)
- cout << "Send on socket " << writeFd << ": " << *frame << endl;
- frame->encode(out);
- out.flip();
// TODO: AMS 1/6/07 This only works because we already have the correct fd
// in the descriptor - change not to use assigment
writeEvent = WriteEvent(
@@ -225,11 +224,10 @@ void EventChannelConnection::endRead() {
in.flip();
AMQFrame frame;
while (frame.decode(in)) {
- // TODO aconway 2006-11-30: received should take Frame&
if (isTrace)
cout << "Received on socket " << readFd
<< ": " << frame << endl;
- handler->received(&frame);
+ handler->received(frame);
}
in.compact();
startRead();