Better way to init the msghdr fields
This commit is contained in:
@@ -125,14 +125,9 @@ 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;
|
struct msghdr msg{};
|
||||||
msg.msg_name = nullptr;
|
|
||||||
msg.msg_namelen = 0;
|
|
||||||
msg.msg_iov = msg_iov;
|
msg.msg_iov = msg_iov;
|
||||||
msg.msg_iovlen = 0;
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user