]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
AsyncConnection: Let receiver ack message ASAP 6478/head
authorHaomai Wang <haomai@xsky.com>
Thu, 5 Nov 2015 18:20:21 +0000 (02:20 +0800)
committerHaomai Wang <haomai@xsky.com>
Thu, 5 Nov 2015 18:24:09 +0000 (02:24 +0800)
Currently dispatchers may exists logic requires ack message ASAP in order to
avoid sender resend messages when socket error.

Fix #136666
Signed-off-by: Haomai Wang <haomai@xsky.com>
src/msg/async/AsyncConnection.cc

index 42c55adad58c1ce19f63514243f9d97a9e7dee2a..6799adf0d5a9c2f38c866ef0cd9c6a6fe588f435 100644 (file)
@@ -437,6 +437,7 @@ void AsyncConnection::process()
 {
   int r = 0;
   int prev_state = state;
+  bool already_dispatch_writer = false;
   Mutex::Locker l(lock);
   do {
     ldout(async_msgr->cct, 20) << __func__ << " state is " << get_state_name(state)
@@ -842,10 +843,12 @@ void AsyncConnection::process()
          ldout(async_msgr->cct, 1) << " == rx == " << message->get_source() << " seq "
                                     << message->get_seq() << " " << message << " " << *message << dendl;
 
-          // if send_message always successfully send, it may have no
-          // opportunity to send seq ack. 10 is a experience value.
-          if (ack_left.inc() > 10) {
+          ack_left.inc();
+          // if send_message always send inline, it may have no
+          // opportunity to send seq ack.
+          if (!already_dispatch_writer) {
             center->dispatch_event_external(write_handler);
+            already_dispatch_writer = true;
           }
 
           state = STATE_OPEN;