]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
AsyncMessenger: Try send in queue bufferlist
authorHaomai Wang <haomaiwang@gmail.com>
Tue, 11 Nov 2014 15:14:03 +0000 (23:14 +0800)
committerHaomai Wang <haomaiwang@gmail.com>
Tue, 11 Nov 2014 16:10:24 +0000 (00:10 +0800)
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>
src/msg/async/AsyncConnection.cc

index 07cd056421d4e27f7973b2c67e3fb12b2e77cbc0..e1c82fc8d9355018f4861c50893ee0b14318ff09 100644 (file)
@@ -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);