]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph_test_msgr: clean previous sent queue infos
authorHaomai Wang <haomai@xsky.com>
Thu, 7 Jul 2016 11:12:46 +0000 (19:12 +0800)
committerHaomai Wang <haomai@xsky.com>
Tue, 12 Jul 2016 15:59:43 +0000 (23:59 +0800)
1. A -> B
2. goto standby
3. B mark down
4. A reconnect to B
5. got reset session and dispatch remote reset
6. because remote reset is executed in DispatchQueue, it will be delayed
7. A -> B successfully and begin to send message
8. assert because we found the first message is missing but it's reasonble

if policy.resetcheck is true

Signed-off-by: Haomai Wang <haomai@xsky.com>
src/test/msgr/test_msgr.cc

index df849665a78b7a4a28253d23cfa7f2399368927d..a94c77125b294c38419c768a741da2613dafa2e3 100644 (file)
@@ -777,12 +777,24 @@ class SyntheticDispatcher : public Dispatcher {
   }
 
   void ms_handle_fast_connect(Connection *con) {
-    lock.Lock();
+    Mutex::Locker l(lock);
+    list<uint64_t> c = conn_sent[con];
+    for (list<uint64_t>::iterator it = c.begin();
+         it != c.end(); ++it)
+      sent.erase(*it);
+    conn_sent.erase(con);
     got_connect = true;
     cond.Signal();
-    lock.Unlock();
   }
-  void ms_handle_fast_accept(Connection *con) { }
+  void ms_handle_fast_accept(Connection *con) {
+    Mutex::Locker l(lock);
+    list<uint64_t> c = conn_sent[con];
+    for (list<uint64_t>::iterator it = c.begin();
+         it != c.end(); ++it)
+      sent.erase(*it);
+    conn_sent.erase(con);
+    cond.Signal();
+  }
   bool ms_dispatch(Message *m) {
     assert(0);
   }