You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2008/10/13 22:57:14 UTC

svn commit: r704245 - in /incubator/qpid/trunk/qpid/cpp/src/qpid/client: SessionImpl.cpp SessionImpl.h

Author: gsim
Date: Mon Oct 13 13:57:14 2008
New Revision: 704245

URL: http://svn.apache.org/viewvc?rev=704245&view=rev
Log:
Reverted a small part of r703237 as it causes deadlocks under load. Session controls can _not_ be subject to bounds checking on the queue of outgoing frames as is done for commands.


Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/client/SessionImpl.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/client/SessionImpl.h

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/client/SessionImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/client/SessionImpl.cpp?rev=704245&r1=704244&r2=704245&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/client/SessionImpl.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/client/SessionImpl.cpp Mon Oct 13 13:57:14 2008
@@ -59,7 +59,8 @@
       connectionShared(conn),
       connectionWeak(conn),
       weakPtr(false),
-      proxy(out),
+      ioHandler(*this),
+      proxy(ioHandler),
       nextIn(0),
       nextOut(0)
 {
@@ -424,9 +425,22 @@
 
 void SessionImpl::handleOut(AMQFrame& frame) // user thread
 {
+    sendFrame(frame, true);
+}
+
+void SessionImpl::proxyOut(AMQFrame& frame) // network thread
+{
+    //Note: this case is treated slightly differently that command
+    //frames sent by application; session controls should not be
+    //blocked by bounds checking on the outgoing frame queue.
+    sendFrame(frame, false);
+}
+
+void SessionImpl::sendFrame(AMQFrame& frame, bool canBlock)
+{
     boost::shared_ptr<ConnectionImpl> c =  connectionWeak.lock();
     if (c) {
-        c->expand(frame.encodedSize(), true);
+        c->expand(frame.encodedSize(), canBlock);
         channel.handle(frame);
     }
 }

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/client/SessionImpl.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/client/SessionImpl.h?rev=704245&r1=704244&r2=704245&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/client/SessionImpl.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/client/SessionImpl.h Mon Oct 13 13:57:14 2008
@@ -137,6 +137,14 @@
 
     void handleIn(framing::AMQFrame& frame);
     void handleOut(framing::AMQFrame& frame);
+    /**
+     * Sends session controls. This case is treated slightly
+     * differently than command frames sent by the application via
+     * handleOut(); session controlsare not subject to bounds checking
+     * on the outgoing frame queue.
+     */
+    void proxyOut(framing::AMQFrame& frame);
+    void sendFrame(framing::AMQFrame& frame, bool canBlock);
     void deliver(framing::AMQFrame& frame);
 
     Future sendCommand(const framing::AMQBody&, const framing::MethodContent* = 0);
@@ -185,6 +193,7 @@
     boost::weak_ptr<ConnectionImpl> connectionWeak;
     bool weakPtr;
 
+    framing::FrameHandler::MemFunRef<SessionImpl, &SessionImpl::proxyOut> ioHandler;
     framing::ChannelHandler channel;
     framing::AMQP_ServerProxy::Session proxy;