]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: Let requeue_sent remove items completely, given a seq to remove from.
authorGreg Farnum <gregf@hq.newdream.net>
Tue, 7 Sep 2010 20:55:17 +0000 (13:55 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Mon, 13 Sep 2010 18:47:48 +0000 (11:47 -0700)
src/msg/SimpleMessenger.cc
src/msg/SimpleMessenger.h

index 7e958d15885366dbbf3814a31746cfbe949d2ba9..9ce7cafecefd80068959fa72b956becad8c873d6 100644 (file)
@@ -1207,7 +1207,7 @@ void SimpleMessenger::Pipe::unregister_pipe()
 }
 
 
-void SimpleMessenger::Pipe::requeue_sent()
+void SimpleMessenger::Pipe::requeue_sent(uint64_t max_acked)
 {
   if (sent.empty())
     return;
@@ -1215,11 +1215,14 @@ void SimpleMessenger::Pipe::requeue_sent()
   list<Message*>& rq = out_q[CEPH_MSG_PRIO_HIGHEST];
   while (!sent.empty()) {
     Message *m = sent.back();
-    sent.pop_back();
-    dout(10) << "requeue_sent " << *m << " for resend seq " << out_seq
-            << " (" << m->get_seq() << ")" << dendl;
-    rq.push_front(m);
-    out_seq--;
+    if (m->get_seq() > max_acked) {
+      sent.pop_back();
+      dout(10) << "requeue_sent " << *m << " for resend seq " << out_seq
+          << " (" << m->get_seq() << ")" << dendl;
+      rq.push_front(m);
+      out_seq--;
+    } else
+      sent.clear();
   }
 }
 
index 78278f256eedbded87e77f18e90f5f8b5d02b721..93e00fe96fe7c93f0927ea6b98421470fece4b55 100644 (file)
@@ -349,7 +349,9 @@ private:
       return m;
     }
 
-    void requeue_sent();
+    /* Remove all messages from the sent queue. Add those with seq > max_acked
+     * to the highest priority outgoing queue. */
+    void requeue_sent(uint64_t max_acked=0);
     void discard_queue();
 
     void force_close() {