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 <haomaiwang@gmail.com>
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();
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);