Skip to content

Commit

Permalink
AsyncConnection: let ack reply use MSG_MORE flag
Browse files Browse the repository at this point in the history
Signed-off-by: Haomai Wang <haomai@xsky.com>
  • Loading branch information
yuyuyu101 committed Jan 28, 2016
1 parent c546fda commit cc7c83a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/msg/async/AsyncConnection.cc
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions src/msg/async/AsyncConnection.h
Expand Up @@ -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);
Expand Down

0 comments on commit cc7c83a

Please sign in to comment.