From 1a6817a507864c92579f3e90f2cb3b19f6e7ee94 Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Thu, 26 Oct 2017 00:50:29 +0800 Subject: [PATCH] msg/async: updating l_msgr_running_send_time if write_message failed. Also for the most time write_message return zero. So avoid checking "r < 0 or r > 0" every time, it should firstly check "r == 0". Signed-off-by: Jianpeng Ma --- src/msg/async/AsyncConnection.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 30eec2f3f30..37b77807e77 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -2402,13 +2402,15 @@ void AsyncConnection::handle_write() prepare_send_message(get_features(), m, data); r = write_message(m, data, more); - if (r < 0) { - ldout(async_msgr->cct, 1) << __func__ << " send msg failed" << dendl; - goto fail; - } + write_lock.lock(); - if (r > 0) - break; + if (r == 0) { + ; + } else if (r < 0) { + ldout(async_msgr->cct, 1) << __func__ << " send msg failed" << dendl; + break; + } else if (r > 0) + break; } while (can_write == WriteStatus::CANWRITE); write_lock.unlock(); -- 2.39.5