- we should reset state_offset when read done.
- check outgoing_bl before we try to write a message.
In some environments, network would temporily block and return EAGAIN.
For async msgr, we would callback the write event directly, but that still
increase the outgoing_bl.
Think about this case, the sender is in congestion or network driver
has some problems. The data appended to outgoing_bl and outgoing_bl
is not consumed up-to-date immediately.
That size of outgoing_bl will increase with time then overflow.
The wrong outgoing_bl would cause some problems so we need to wait
for outgoing_bl before we appended another message.
Signed-off-by: Vicente Cheng <vicente_cheng@bigtera.com>
<< " left is " << left << " buffer still has "
<< recv_end - recv_start << dendl;
if (left == 0) {
+ state_offset = 0;
return 0;
}
state_offset += to_read;
auto start = ceph::mono_clock::now();
bool more;
do {
+ if (connection->is_queued()) {
+ if (r = connection->_try_send(); r!= 0) {
+ // either fails to send or not all queued buffer is sent
+ break;
+ }
+ }
+
ceph::buffer::list data;
Message *m = _get_next_outgoing(&data);
if (!m) {
auto start = ceph::mono_clock::now();
bool more;
do {
+ if (connection->is_queued()) {
+ if (r = connection->_try_send(); r!= 0) {
+ // either fails to send or not all queued buffer is sent
+ break;
+ }
+ }
+
const auto out_entry = _get_next_outgoing();
if (!out_entry.m) {
break;