]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
AsyncConnection: let ack reply use MSG_MORE flag 7380/head
authorHaomai Wang <haomai@xsky.com>
Thu, 28 Jan 2016 04:19:23 +0000 (12:19 +0800)
committerHaomai Wang <haomai@xsky.com>
Mon, 1 Feb 2016 07:28:22 +0000 (15:28 +0800)
Signed-off-by: Haomai Wang <haomai@xsky.com>
src/msg/async/AsyncConnection.cc
src/msg/async/AsyncConnection.h

index 01a7335293abc446f2e6d7d56abd240ce1f1518d..8c0cccb295cb93a5f2f1ba0f7a1f79d359e04656 100644 (file)
@@ -347,7 +347,7 @@ ssize_t AsyncConnection::do_sendmsg(struct msghdr &msg, unsigned len, bool more)
 
 // return the remaining bytes, it may larger than the length of ptr
 // else return < 0 means error
-ssize_t AsyncConnection::_try_send(bufferlist &send_bl, bool send)
+ssize_t AsyncConnection::_try_send(bufferlist &send_bl, bool send, bool more)
 {
   ldout(async_msgr->cct, 20) << __func__ << " send bl length is " << send_bl.length() << dendl;
   if (send_bl.length()) {
@@ -384,7 +384,7 @@ ssize_t AsyncConnection::_try_send(bufferlist &send_bl, bool send)
       size--;
     }
 
-    ssize_t r = do_sendmsg(msg, msglen, left_pbrs);
+    ssize_t r = do_sendmsg(msg, msglen, left_pbrs || more);
     if (r < 0)
       return r;
 
@@ -2459,7 +2459,7 @@ void AsyncConnection::_send_keepalive_or_ack(bool ack, utime_t *tp)
   }
 
   ldout(async_msgr->cct, 10) << __func__ << " try send keepalive or ack" << dendl;
-  _try_send(bl, false);
+  _try_send(bl, false, true);
 }
 
 void AsyncConnection::handle_write()
@@ -2503,7 +2503,7 @@ void AsyncConnection::handle_write()
       bl.append((char*)&s, sizeof(s));
       ldout(async_msgr->cct, 10) << __func__ << " try send msg ack, acked " << left << " messages" << dendl;
       ack_left.sub(left);
-      r = _try_send(bl);
+      r = _try_send(bl, true, true);
     } else if (is_queued()) {
       r = _try_send(bl);
     }
index 44dc1f436ad7d5d40842c995ff5a3f0a6a67a5c8..049c2afee15a650fe590b2d912291df4964facee 100644 (file)
@@ -49,13 +49,13 @@ class AsyncConnection : public Connection {
   void suppress_sigpipe();
   void restore_sigpipe();
   ssize_t do_sendmsg(struct msghdr &msg, unsigned len, bool more);
-  ssize_t try_send(bufferlist &bl, bool send=true) {
+  ssize_t try_send(bufferlist &bl, bool send=true, bool more=false) {
     Mutex::Locker l(write_lock);
-    return _try_send(bl, send);
+    return _try_send(bl, send, more);
   }
   // if "send" is false, it will only append bl to send buffer
   // the main usage is avoid error happen outside messenger threads
-  ssize_t _try_send(bufferlist &bl, bool send=true);
+  ssize_t _try_send(bufferlist &bl, bool send=true, bool more=false);
   ssize_t _send(Message *m);
   void prepare_send_message(uint64_t features, Message *m, bufferlist &bl);
   ssize_t read_until(unsigned needed, char *p);