]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: maintain list of accepting pipes
authorSage Weil <sage@inktank.com>
Tue, 16 Jul 2013 00:14:25 +0000 (17:14 -0700)
committerSage Weil <sage@inktank.com>
Wed, 17 Jul 2013 21:39:04 +0000 (14:39 -0700)
New pipes exist in a sort of limbo before we know who the peer is and
add them to rank_pipe.  Keep a list of them in accepting_pipes for that
period.

Signed-off-by: Sage Weil <sage@inktank.com>
src/msg/Pipe.cc
src/msg/SimpleMessenger.cc
src/msg/SimpleMessenger.h

index 5c10e1b8cd53479e0b1edec870acb9ebd03b1b2b..22114f48e62fc594cf14452922a60c41df12ce7f 100644 (file)
@@ -595,6 +595,7 @@ int Pipe::accept()
   // open
   connect_seq = connect.connect_seq + 1;
   peer_global_seq = connect.global_seq;
+  assert(state == STATE_ACCEPTING);
   state = STATE_OPEN;
   ldout(msgr->cct,10) << "accept success, connect_seq = " << connect_seq << ", sending READY" << dendl;
 
@@ -621,6 +622,8 @@ int Pipe::accept()
   // ok!
   if (msgr->dispatch_queue.stop)
     goto shutting_down;
+  inr removed = msgr->accepting_pipes.erase(this);
+  assert(removed == 1);
   register_pipe();
   msgr->lock.Unlock();
 
@@ -1098,6 +1101,7 @@ void Pipe::unregister_pipe()
     msgr->rank_pipe.erase(p);
   } else {
     ldout(msgr->cct,10) << "unregister_pipe - not registered" << dendl;
+    msgr->accepting_pipes.erase(this);  // somewhat overkill, but safe.
   }
 }
 
index 2afa449dfbce9dd85a8d330d68cda831c3035134..0a3b33860af2d4d61d490fdf47aa712971999c19 100644 (file)
@@ -312,6 +312,7 @@ Pipe *SimpleMessenger::add_accept_pipe(int sd)
   p->start_reader();
   p->pipe_lock.Unlock();
   pipes.insert(p);
+  accepting_pipes.insert(p);
   lock.Unlock();
   return p;
 }
index 47ee145aa5e129731c5dbd2fab04bfd3ded385c6..4538b0f18bcf29edf6366f5897094b131038ffce 100644 (file)
@@ -514,6 +514,12 @@ private:
    * invalid and can be replaced by anyone holding the msgr lock
    */
   hash_map<entity_addr_t, Pipe*> rank_pipe;
+  /**
+   * list of pipes are in teh process of accepting
+   *
+   * These are not yet in the rank_pipe map.
+   */
+  set<Pipe*> accepting_pipes;
   /// a set of all the Pipes we have which are somehow active
   set<Pipe*>      pipes;
   /// a list of Pipes we want to tear down