From fc5918e5a8bb1eb88b98689c463c3574a64e8bef Mon Sep 17 00:00:00 2001 From: JosiahWI <41302989+JosiahWI@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:37:36 -0500 Subject: [PATCH] Update InkAPITest.cc for new `con.sock` field (#11674) * Constify buffer parameters on socket write methods * Update InkAPITest.cc for new `con.sock` field --- include/iocore/eventsystem/UnixSocket.h | 14 +++++++------- src/api/InkAPITest.cc | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/iocore/eventsystem/UnixSocket.h b/include/iocore/eventsystem/UnixSocket.h index a770e5d8cba..08cbdb7bd13 100644 --- a/include/iocore/eventsystem/UnixSocket.h +++ b/include/iocore/eventsystem/UnixSocket.h @@ -84,10 +84,10 @@ class UnixSocket int recvmmsg(struct mmsghdr *msgvec, int vlen, int flags, struct timespec *timeout) const; #endif - std::int64_t write(void *buf, int size) const; + std::int64_t write(void const *buf, int size) const; - int send(void *buf, int size, int flags) const; - int sendto(void *buf, int size, int flags, struct sockaddr const *to, int tolen) const; + int send(void const *buf, int size, int flags) const; + int sendto(void const *buf, int size, int flags, struct sockaddr const *to, int tolen) const; int sendmsg(struct msghdr const *m, int flags) const; static int poll(struct pollfd *fds, unsigned long nfds, int timeout); @@ -203,7 +203,7 @@ UnixSocket::recvmmsg(struct mmsghdr *msgvec, int vlen, int flags, struct timespe #endif inline std::int64_t -UnixSocket::write(void *buf, int size) const +UnixSocket::write(void const *buf, int size) const { std::int64_t r; do { @@ -216,11 +216,11 @@ UnixSocket::write(void *buf, int size) const } inline int -UnixSocket::send(void *buf, int size, int flags) const +UnixSocket::send(void const *buf, int size, int flags) const { int r; do { - if (unlikely((r = ::send(this->fd, static_cast(buf), size, flags)) < 0)) { + if (unlikely((r = ::send(this->fd, static_cast(buf), size, flags)) < 0)) { r = -errno; } } while (r == -EINTR); @@ -228,7 +228,7 @@ UnixSocket::send(void *buf, int size, int flags) const } inline int -UnixSocket::sendto(void *buf, int len, int flags, struct sockaddr const *to, int tolen) const +UnixSocket::sendto(void const *buf, int len, int flags, struct sockaddr const *to, int tolen) const { int r; do { diff --git a/src/api/InkAPITest.cc b/src/api/InkAPITest.cc index f2c818f7d3b..63876b6b152 100644 --- a/src/api/InkAPITest.cc +++ b/src/api/InkAPITest.cc @@ -1454,7 +1454,7 @@ client_handler(TSCont contp, TSEvent event, void *data) // happen until data arrives on the socket. Because we're just testing the accept() // we write a small amount of ignored data to make sure this gets triggered. UnixNetVConnection *vc = static_cast(data); - ink_release_assert(::write(vc->con.fd, "Bob's your uncle", 16) != 0); + ink_release_assert(vc->con.sock.write("Bob's your uncle", 16) != 0); sleep(1); // XXX this sleep ensures the server end gets the accept event.