From c8f56ab2a21cdec4b892d8fb030af17fec5d7735 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 27 Dec 2014 15:04:00 +0800 Subject: [PATCH] AsyncMessender: use IOV_MAX instead of IOV_LEN Signed-off-by: Kefu Chai --- src/msg/async/AsyncConnection.cc | 2 +- src/msg/async/AsyncConnection.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index c6a630182732..26552fffb847 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -307,7 +307,7 @@ int AsyncConnection::_try_send(bufferlist send_bl, bool send) uint64_t left_pbrs = outcoming_bl.buffers().size(); while (left_pbrs) { struct msghdr msg; - uint64_t size = MIN(left_pbrs, IOV_LEN); + uint64_t size = MIN(left_pbrs, sizeof(msgvec)); left_pbrs -= size; memset(&msg, 0, sizeof(msg)); msg.msg_iovlen = 0; diff --git a/src/msg/async/AsyncConnection.h b/src/msg/async/AsyncConnection.h index 348a87b90250..c3572c4f1713 100644 --- a/src/msg/async/AsyncConnection.h +++ b/src/msg/async/AsyncConnection.h @@ -18,6 +18,7 @@ #define CEPH_MSG_ASYNCCONNECTION_H #include +#include #include #include using namespace std; @@ -42,7 +43,6 @@ class AsyncMessenger; * sequence, try to reconnect peer endpoint. */ class AsyncConnection : public Connection { - const static uint64_t IOV_LEN = 1024; int read_bulk(int fd, char *buf, int len); int do_sendmsg(struct msghdr &msg, int len, bool more); @@ -262,7 +262,7 @@ class AsyncConnection : public Connection { EventCallbackRef signal_handler; EventCallbackRef local_deliver_handler; bool keepalive; - struct iovec msgvec[IOV_LEN]; + struct iovec msgvec[IOV_MAX]; Mutex stop_lock; // used to protect `mark_down_cond` Cond stop_cond; set register_time_events; // need to delete it if stop -- 2.47.3