Browse Source

Do not try to push more segments than IOV_MAX at once as it leads to EMSGSIZE

tags/v0.5.1
Vitaliy Filippov 2 months ago
parent
commit
824ea507d0
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      msgr_send.cpp

+ 5
- 2
msgr_send.cpp View File

@@ -1,6 +1,9 @@
// Copyright (c) Vitaliy Filippov, 2019+
// License: VNPL-1.0 or GNU GPL-2.0+ (see README.md for details)

#define _XOPEN_SOURCE
#include <limits.h>

#include "messenger.h"

void osd_messenger_t::outbox_push(osd_op_t *cur_op)
@@ -130,7 +133,7 @@ bool osd_messenger_t::try_send(osd_client_t *cl)
return false;
}
cl->write_msg.msg_iov = cl->send_list.data();
cl->write_msg.msg_iovlen = cl->send_list.size();
cl->write_msg.msg_iovlen = cl->send_list.size() < IOV_MAX ? cl->send_list.size() : IOV_MAX;
cl->refs++;
ring_data_t* data = ((ring_data_t*)sqe->user_data);
data->callback = [this, cl](ring_data_t *data) { handle_send(data->res, cl); };
@@ -139,7 +142,7 @@ bool osd_messenger_t::try_send(osd_client_t *cl)
else
{
cl->write_msg.msg_iov = cl->send_list.data();
cl->write_msg.msg_iovlen = cl->send_list.size();
cl->write_msg.msg_iovlen = cl->send_list.size() < IOV_MAX ? cl->send_list.size() : IOV_MAX;
cl->refs++;
int result = sendmsg(peer_fd, &cl->write_msg, MSG_NOSIGNAL);
if (result < 0)


Loading…
Cancel
Save