]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Asyncconnection: Fix in_seq_acked problem
authorHaomai Wang <haomaiwang@gmail.com>
Sun, 28 Sep 2014 02:31:01 +0000 (10:31 +0800)
committerHaomai Wang <haomaiwang@gmail.com>
Wed, 8 Oct 2014 06:04:59 +0000 (14:04 +0800)
Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
src/msg/AsyncConnection.cc

index 3fe7402c46731bf14e89e1689916a815f2098729..509e586416d13a1e77e6f5f69e2bfb1493660960 100644 (file)
@@ -1787,6 +1787,7 @@ void AsyncConnection::was_session_reset()
 
   in_seq = 0;
   connect_seq = 0;
+  in_seq_acked = 0;
 }
 
 void AsyncConnection::mark_down()
@@ -1985,22 +1986,7 @@ void AsyncConnection::handle_write()
       keepalive = false;
     }
 
-    if (in_seq > in_seq_acked) {
-      ceph_le64 s;
-      s = in_seq;
-      bl.append(CEPH_MSGR_TAG_ACK);
-      bl.append((char*)&s, sizeof(s));
-      ldout(async_msgr->cct, 10) << __func__ << " try send msg ack" << dendl;
-    }
-
-    r = _try_send(bl);
-    if (r < 0) {
-      ldout(async_msgr->cct, 1) << __func__ << " send msg ack failed" << dendl;
-      goto fail;
-    } else if (r > 0) {
-      return ;
-    }
-
+    bool send = true;
     while (1) {
       Message *m = _get_next_outgoing();
       if (!m)
@@ -2013,9 +1999,26 @@ void AsyncConnection::handle_write()
         ldout(async_msgr->cct, 1) << __func__ << " send msg failed" << dendl;
         goto fail;
       } else if (r > 0) {
+        send = false;
         break;
       }
     }
+    if (in_seq > in_seq_acked) {
+      ceph_le64 s;
+      s = in_seq;
+      bl.append(CEPH_MSGR_TAG_ACK);
+      bl.append((char*)&s, sizeof(s));
+      ldout(async_msgr->cct, 10) << __func__ << " try send msg ack" << dendl;
+      in_seq_acked = s;
+    }
+
+    r = _try_send(bl, send);
+    if (r < 0) {
+      ldout(async_msgr->cct, 1) << __func__ << " send msg ack failed" << dendl;
+      goto fail;
+    } else if (r > 0) {
+      return ;
+    }
   } else if (state != STATE_CONNECTING) {
     r = _try_send(bl);
     if (r < 0) {