]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg: make clear_pipe work only on a given Pipe, rather than the current one.
authorGreg Farnum <greg@inktank.com>
Fri, 1 Jun 2012 23:46:39 +0000 (16:46 -0700)
committerGreg Farnum <greg@inktank.com>
Mon, 4 Jun 2012 04:31:16 +0000 (21:31 -0700)
This way old Pipes that have been replaced can't clear the new Pipe
out of a Connection's link.
We might attempt to instead sever the link between CLOSED Pipes and
their Connections more completely (eg, when the Connection gets a
new Pipe), but that will require more work to handle all the
cases, and this works for now.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/msg/Message.h
src/msg/SimpleMessenger.cc

index 8244cccb2199ed4a97a1f0f2d050e82a4f58cf04..b4071ed2d080fd23cd8ebd9feb8e122740954888 100644 (file)
@@ -200,9 +200,9 @@ public:
       return pipe->get();
     return NULL;
   }
-  void clear_pipe() {
-    Mutex::Locker l(lock);
-    if (pipe) {
+  void clear_pipe(RefCountedObject *old_p) {
+    if(old_p == pipe) {
+      Mutex::Locker l(lock);
       pipe->put();
       pipe = NULL;
     }
index 14c57e069154a6db948e225d0b4f521c23015a6b..da12b9f6aa969f19af3aa21a50b3027d39ce2d0c 100644 (file)
@@ -2286,7 +2286,7 @@ void SimpleMessenger::reaper()
       ::close(p->sd);
     ldout(cct,10) << "reaper reaped pipe " << p << " " << p->get_peer_addr() << dendl;
     if (p->connection_state)
-      p->connection_state->clear_pipe();
+      p->connection_state->clear_pipe(p);
     p->put();
     ldout(cct,10) << "reaper deleted pipe " << p << dendl;
   }