From: Haomai Wang Date: Thu, 5 Nov 2015 18:20:21 +0000 (+0800) Subject: AsyncConnection: Let receiver ack message ASAP X-Git-Tag: v10.0.1~78^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=88e0b2c3a0366df3953de204e3b92aeb536723bf;p=ceph.git AsyncConnection: Let receiver ack message ASAP 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 --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 42c55adad58c..6799adf0d5a9 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -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;