Explicitely init the msghdr fields, to be compatible with any implementation

This commit is contained in:
louiz’
2017-04-20 19:14:59 +02:00
parent 78765a4bc4
commit 69fd6cc4c3
+8 -3
View File
@@ -125,9 +125,14 @@ ssize_t TCPSocketHandler::do_recv(void* recv_buf, const size_t buf_size)
void TCPSocketHandler::on_send() void TCPSocketHandler::on_send()
{ {
struct iovec msg_iov[UIO_FASTIOV] = {}; struct iovec msg_iov[UIO_FASTIOV] = {};
struct msghdr msg{nullptr, 0, struct msghdr msg;
msg_iov, msg.msg_name = nullptr;
0, nullptr, 0, 0}; msg.msg_namelen = 0;
msg.msg_iov = msg_iov;
msg.msg_iovlen = 0;
msg.msg_control = nullptr;
msg.msg_controllen = 0;
msg.msg_flags = 0;
for (const std::string& s: this->out_buf) for (const std::string& s: this->out_buf)
{ {
// unconsting the content of s is ok, sendmsg will never modify it // unconsting the content of s is ok, sendmsg will never modify it