From: Haomai Wang Date: Tue, 11 Nov 2014 15:14:03 +0000 (+0800) Subject: AsyncMessenger: Try send in queue bufferlist X-Git-Tag: v0.90~51^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d145ccadb851f6d1b5296e4bdc361a325108c078;p=ceph.git AsyncMessenger: Try send in queue bufferlist If previous try_send failed to send all buffers, it will create write event for next write. But if the message queue is empty and no need to send in_seq_acked, handle_write will skip to send and in this condition buffers in queue won't be send forever. Signed-off-by: Haomai Wang --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 07cd056421d4..e1c82fc8d935 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -1998,7 +1998,7 @@ void AsyncConnection::handle_write() ldout(async_msgr->cct, 10) << __func__ << " started." << dendl; Mutex::Locker l(lock); bufferlist bl; - int r; + int r = 0; if (state >= STATE_OPEN && state <= STATE_OPEN_TAG_CLOSE) { if (keepalive) { _send_keepalive_or_ack(); @@ -2027,7 +2027,14 @@ 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); + r = _try_send(bl); + } else if (is_queued()) { + r = _try_send(bl); + } + + if (r < 0) { + ldout(async_msgr->cct, 1) << __func__ << " send msg failed" << dendl; + goto fail; } } else if (state != STATE_CONNECTING) { r = _try_send(bl);