From: Haomai Wang Date: Wed, 1 Oct 2014 03:02:20 +0000 (+0800) Subject: AsyncConnection: Avoid seq ack not send and skip sd<0 shutdown X-Git-Tag: v0.88~37^2~4^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b8ae5629050310da9309ceb25207e5a26aabe35b;p=ceph.git AsyncConnection: Avoid seq ack not send and skip sd<0 shutdown Signed-off-by: Haomai Wang --- diff --git a/src/msg/AsyncConnection.cc b/src/msg/AsyncConnection.cc index 535345b120e..3d246aae896 100644 --- a/src/msg/AsyncConnection.cc +++ b/src/msg/AsyncConnection.cc @@ -694,6 +694,13 @@ void AsyncConnection::process() in_seq = message->get_seq(); ldout(async_msgr->cct, 10) << __func__ << " got message " << 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 (in_seq > in_seq_acked + 10) { + center->create_time_event(2, write_handler); + } + state = STATE_OPEN; async_msgr->ms_fast_preprocess(message); @@ -1747,8 +1754,10 @@ void AsyncConnection::fault() return ; } - shutdown_socket(); - center->delete_file_event(sd, EVENT_READABLE|EVENT_WRITABLE); + if (sd >= 0) { + shutdown_socket(); + center->delete_file_event(sd, EVENT_READABLE|EVENT_WRITABLE); + } open_write = false; // requeue sent items @@ -1824,7 +1833,8 @@ void AsyncConnection::_stop() outcoming_bl.clear(); if (policy.lossy) was_session_reset(); - center->delete_file_event(sd, EVENT_READABLE|EVENT_WRITABLE); + if (sd >= 0) + center->delete_file_event(sd, EVENT_READABLE|EVENT_WRITABLE); open_write = false; state = STATE_CLOSED; } @@ -2022,7 +2032,7 @@ void AsyncConnection::handle_write() bl.append((char*)&s, sizeof(s)); ldout(async_msgr->cct, 10) << __func__ << " try send msg ack" << dendl; in_seq_acked = s; - _try_send(bl, false); + _try_send(bl); } } else if (state != STATE_CONNECTING) { r = _try_send(bl);